javascript - Angular JS Binding not working -
i not sure going wrong in following code - doesn't seems working. can help?
<body ng-controller="myfunction"> <script> function myfunction($scope) { $scope.author = { 'name':'test', 'title': 'mr', 'job': 'sde' } } </script> <h2> {{author.name}} </h2> <h2> {{author.title + " " + author.job}} </h2> </body>
here are. incorrect in structure of angularjs, don't see ng-app , wrong declare controller:
angular.module('app', []).controller('myfunction', function($scope) { $scope.author = { 'name': 'test', 'title': 'mr', 'job': 'sde' } }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <body ng-app='app' ng-controller="myfunction"> <h2> {{author.name}} </h2> <h2> {{author.title + " " + author.job}} </h2> </body> hope helps.
Comments
Post a Comment