javascript - Angular best practice (in this situation) for passing data between controllers - service or routeParams? -


I am quite new to Angelur JS and I know that this question has been asked before (so hopefully I will not be able to vote) but I have not found a question matching my situation.

I want to send a search code (about 4 fields) from a search page (my hometrack) to a listing site.

Anything that I have read, uses assertiveness to use another server / data, based on Limiting CTM already an API (which currently makes the data difficult) Uses a factory / service to get information. Between the search page and the list page (and forgive me if I'm missing something) why not just pass these extra parameters as a route ??

If you want to know - I'm partially using the route parameter to navigate around the app and pass some simple ID between the pages.

I

If you want constant data to stock,

This module uses localStorage () (or the cookie if you use IE)

Unexpected example :

Service

  myApp.service ('Controller Sharing Data', function () {var __variables = {}; return {get: function (Varname) {Return (__variables [varname]! == 'undefined')? __variab lace [varnam]: false;}, set: function (varna In value) {__variables [varname] = value;}};});  

Controller

  myApp.controller ('IndexCtrl', function ($ radius, controller SHaringData) {controllerSharingData.set ( 'Toto', 'hello world');}); MyApp.controller ('ListCtrl', Function ($ Scope, Controller SHaringData) {Warning (Controller SHaringData.get ('toto'));});  

Comments