javascript - How to pass a variable to config file in AngularJS -
javascript - How to pass a variable to config file in AngularJS -
in app.js file have .config has states navigation urls. want pass variable container.html file config file, state base of operations url follows:
// setup abstract state tabs directive .state('tab', { url: "/tab", abstract: true, templateurl: "templates/container.html" }) i want pass variable called partition have value either "agriculture" or "construction" , based on variable want farther operations. can help me pretty new angularjs. additional info: working on cordova, angularjs, taffy mobile app. in advance. want url /tab/:division or templates/container.html/division later able utilize in container.html file.
try this
// setup abstract state tabs directive .state('tab', { url: "/tab/:division", abstract: true, templateurl: "templates/container.html", controller:'ctnctrl' }) //controller .controller('ctnctrl', function($scope, $stateparams) { //get value url $scope.division=$stateparams.division; }); //in container.html can read variable <span>{{division}}</span> javascript angularjs cordova
Comments
Post a Comment