javascript - scope variable not getting passed to template included using ng-include -


scope variable not getting passed template included through ng-include tag. want generic.html page come page1.html , page2.html. getting static content hi,welcome when click method in controller1.js name enclosed in angular directive not getting printed. tried name in 1 object $scope.user = {} , added user.name not able bond name in html template.

main.js

 $stateprovider         .state('index', {             parent: 'app',             abstract : true,             url: '/index',             views: {                 'content@': {                     templateurl: urlpath+'ngtemplates/chat/chat.menu.html',                     controller: ['$state',function ($state) {                       $state.go('screen.welcome');                     }]                 }             }         })         .state('screen.welcome', {             url: '',                     templateurl: urlpath+'templates/page1.html',                     controller:'controller1'         })         .state('screen.details', {             url: '',                     templateurl: urlpath+'templates/page2.html',                     controller:'controller2'         }) 

controller1.js

$scope.selected = function(){ $scope.name = "jim"; } 

generic.html

<div ng-app="sampleapp"> <h1> hi, welcome! </h1> <p> {{name}} </p> </div> 

you need add controller template

   <div ng-app="sampleapp">      <div ng-controller = "controller1"> //controller added          <h1> hi, welcome! </h1>         <p> {{name}} </p>     </div>         </div> 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -