Dojo/Angular 范围问题
Dojo/Angular Scope Issue
我有一个包含大量代码的 dojo 模块,我希望能够使用模块中的函数。该模块在我的 angular 控制器中加载正常,但我无法在我的视图中使用在控制器内部修改的范围。我将如何着手完成这个?这是代码:
angular.controller('mapTestController', ['$rootScope','$scope', function ($rootScope,$scope) {
require(['mapping/scripts/mapping'], function (mapping) {
$scope.TestVar= "How do I access this in my view?";
});
$scope.map = {
center: {
lng: -122.45,
lat: 37.75
},
zoom: 13
};
}]);
HTML:
<div ng-app="AngularApp">
<div ng-controller="mapTestController">
{{TestVar}} //this is blank
...
我对 Dojo 不是很熟悉,但答案可能超出了它的范围。
require(['mapping/scripts/mapping'], function (mapping) {
$scope.$apply(function () {
$scope.TestVar= "How do I access this in my view?";
}
});
我有一个包含大量代码的 dojo 模块,我希望能够使用模块中的函数。该模块在我的 angular 控制器中加载正常,但我无法在我的视图中使用在控制器内部修改的范围。我将如何着手完成这个?这是代码:
angular.controller('mapTestController', ['$rootScope','$scope', function ($rootScope,$scope) {
require(['mapping/scripts/mapping'], function (mapping) {
$scope.TestVar= "How do I access this in my view?";
});
$scope.map = {
center: {
lng: -122.45,
lat: 37.75
},
zoom: 13
};
}]);
HTML:
<div ng-app="AngularApp">
<div ng-controller="mapTestController">
{{TestVar}} //this is blank
...
我对 Dojo 不是很熟悉,但答案可能超出了它的范围。
require(['mapping/scripts/mapping'], function (mapping) {
$scope.$apply(function () {
$scope.TestVar= "How do I access this in my view?";
}
});