angularjs의 템플릿 페이지에있는 태그 내에 캔버스를 사용하여 화이트 보드를 구현하는 스크립트가 있습니다. 이제 angularjs 범위 변수에 points [] 변수 값을 지정하려고합니다.angularjs에서 템플릿 스크립트 변수에 액세스하는 방법
<script>
var points = [];
</script>
각도 js 컨트롤러에서이 점에 액세스하는 방법.
scope.ponts = ponints;
angularjs의 템플릿 페이지에있는 태그 내에 캔버스를 사용하여 화이트 보드를 구현하는 스크립트가 있습니다. 이제 angularjs 범위 변수에 points [] 변수 값을 지정하려고합니다.angularjs에서 템플릿 스크립트 변수에 액세스하는 방법
<script>
var points = [];
</script>
각도 js 컨트롤러에서이 점에 액세스하는 방법.
scope.ponts = ponints;
당신은 변수를 얻을 $ 윈도우 서비스를 사용할 수 있습니다 : -
var points = ['1','2'];
var app = angular.module('myapp', []);
app.controller('MainCtrl', ['$scope', '$window', function($scope, $window) {
$scope.point= $window.points ;
}]);
plunker : - 그것은 전역에서와 같이 http://plnkr.co/edit/FzybyOZKiLvHuaMaYCuJ?p=preview
당신은 당신의 컨트롤러에 액세스 할 수 있습니다.
이 plunkr 참조 :
http://plnkr.co/edit/G8RQKe6tK48mWXpsl9ov?p=preview
<script>
var points = [];
</script>
<body ng-controller="MainCtrl">
<p>Points: {{data}}</p>
</body>
</html>
및
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.data = points;
});
오타 scope.points의 = 포인트를 app.js; :-P – squiroid