angularjs - How to pass dynamic data from one module controller to another module controller -



angularjs - How to pass dynamic data from one module controller to another module controller -

i'm new angularjs, want pass dynamic value (username) 1 controller in 1 module controller in module. routing , other things working fine. code

loginmodule.js

(function() { var app = angular.module("waleteros", ["ngroute","ui.bootstrap","ngcookies"]); app.config(function($routeprovider) { $routeprovider .when("/",{ templateurl:"views/login.html", controller:"loginctrl" }) } })

app.js

(function() { var app = angular.module("waleterosadmin", ["ngroute","nggrid","ui.bootstrap","ngcookies"]); app.config(function($routeprovider) { $routeprovider .when("/home",{ templateurl:"homepage.html", controller:"homectrl" }) } })

loginctrl.js

(function(){ var app = angular.module("waleteros"); var loginctrl= function($scope,$location) { $scope.signin=function(email,pin) { //some authentication code... //here want pass username homectrl.js window.location.href="views/home.html" } } app.controller("loginctrl", loginctrl); })

homectrl.js

(function(){ var app = angular.module("waleterosadmin"); var homectrl=function($scope) { //here want username } app.controller("homectrl", homectrl); })

you can share service between modules ,and pass value between modules, please have here share single service between multiple angular.js apps ,and here sharing between modules angularjs?

angularjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -