javascript - How to get a value from controller.js file to html file in angularjs -
i have stored value in scope on controller.js.how scope value in html file.
controller.js
myappcont.controller('listvalue',['$scope','$rootscope','$http', function($scope,$rootscope,$http){ city=$scope.val; }]);
html
<div class="col-md-10" ng-controller="listvalue"> <table class="table table-bordered table-style" id="statustable"> <thead> <tr> <th>values</th> </tr> </thead> <tbody class="align-center"> <tr> <td>{{city}}</td> </tr> </tbody> </table> </div>
you need have $scope variable inside controller, other way
myappcont.controller('listvalue',['$scope','$rootscope','$http', function($scope,$rootscope,$http){ $scope.city=val; }]);
then evaluated , shown in view
<td>{{city}}</td>
working sample
Comments
Post a Comment