javascript - Using variables from two views inside an Angular module -


i have variable, got querystring in doca:

doca(mainview)

var cat = geturlparameter('cat'); 

i have ng-click function in docb handles different views:

docb(rightdrawer)

<li class="item" ng-click="newday('monday')">monday</li> 

$scope.newday

$scope.newday= function(day){     supersonic.ui.layers.push('http://localhost/principal.html?day='+day +'&cat='+cat);     supersonic.ui.drawers.close('right'); } 

i'm trying pass de var "cat" doca $scope.newday

i tried:

calling $window.cat inside $scope.newday, got undefined, assume because i'm trying variable doca inside function in docb.

goal:

go to:

http://localhost/principal.html?day=lunes&cat=0

from "scope.newday" function using variable "cat" doca , "day" [docb]newday('monday')

i suggest directives. agular isolates scopes. directives can inherrit scope.


Comments