javascript - AngularJS: Access controller properties inside script tag in the view -
in app.js have controller wrapped in closure:
(function(){ var app = angular.module('myapp', []); app.controller('areainfo', function($http){...}); })()
in index.html, have:
<body ng-app="myapp" ng-controller="areainfo ctrlareainfo">...</body>
i have no trouble accessing controller's properties in html between body tags, need access properties within <script>
tag so:
<body ng-app="myapp" ng-controller="areainfo ctrlareainfo"> ... <script> var myvar = ctrlareainfo.property; </script> </body>
obviously, code above doesn't work; how access controller's property within <script>
tag?
i ended using ngmap (https://github.com/allenhwkim/angularjs-google-maps) display google maps , works charm.
Comments
Post a Comment