【发布时间】:2017-04-23 09:58:46
【问题描述】:
只是一个简单的例子就清楚了: 在此示例中,如何在 angularApp.js 中使用计算出的 machineLength? 目前,它输出一个空对象,而不是在 angularApp.js 中计算。
<html>
<head>
<script src="...">...</script>
<script>
let machineLength={};
</script>
<script src="angularApp.js"></script>
</head>
<body>
...
<script>
console.log(machineLength);
// here is a lot of code use machineLength to render scene of models with three.js
//the machineLength is the render region width, height. length
</script>
</body>
</html>
angularApp.js:
let sliceApp = angular.module('sliceConfig', []);
sliceApp.
.controller('sliceConfigController', ['$scope', '$http', function($scope, $http)
{
$http.get("http://xxxxx/getSliceConfig")
.success(function(response)
{
$scope.config = [];
$scope.config.machine_width = machineLength.x = parseFloat(response.config.machine_width);
...
}
}]);
任何帮助将不胜感激!
【问题讨论】:
-
angular.value 可能有帮助
-
@A.J 能否提供更多信息,如何使用 angular.value?谢谢
-
我目前无法使用笔记本电脑,我可能会在一个小时后发布一个示例。谢谢(目前使用手机进行交流);)
-
提前谢谢您。我在等你的信息。
标签: javascript html angularjs variables scope