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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -