I have a list of values in $scope from a controller. Need to access those in a non-angular javascript function.
我有一个来自控制器的$scope值列表。需要在非角javascript函数中访问它们。
I have a route like:
我有一条路线:
.when("/display", {
templateUrl: "html/display.html",
controller: "DisplayController"
})
In display.html, I have the following javascript function. I have number of them, in fact
在显示。html,我有下面的javascript函数。事实上,我有很多。
<script>
var g = new JustGage({
id: "gauge",
value: 67,
min: 0,
max: 100,
title: "Visitors"
});
</script>
In above function, value need to be passed from a list variable in $scope from angular DisplayController.
在上面的函数中,值需要从角度显示控制器的$scope中从列表变量传递。
How do I do it? How do I specify the values which are in $scope.list?
我该怎么做呢?如何指定在$scope.list中的值?
I have seen other questions in similar lines.. Proposed solution are like doing something like
我也遇到过类似的问题。提出的解决方案就像做类似的事情
angular.element(myDomElement).scope()
I am using ng-view and not actually specifying any controller in any of the elements. In this case, is it ng-view element?
我使用的是ng-view,实际上没有在任何元素中指定任何控制器。在这种情况下,是ng-view元素吗?
Any help is appreciated.
任何帮助都是感激。
1 个解决方案
#1
2
Why not just instantiate JustGage in your controller and add it to the scope?
为什么不只是在控制器中实例化JustGage并将其添加到范围呢?
#1
2
Why not just instantiate JustGage in your controller and add it to the scope?
为什么不只是在控制器中实例化JustGage并将其添加到范围呢?