[英]AngularJS Controller not getting executed
I am using Angularjs in asp.net core website which has jquery as well. 我在具有jquery的asp.net核心网站中使用Angularjs。 AngularJS is being used for a small part of the website.
AngularJS仅用于网站的一小部分。 Below is the AngularJS HTML
以下是AngularJS HTML
(function () { var app = angular.module('dashBoardApp', []); console.log(app); var xx = app.controller('dashBoardController', ['$scope', function ($scope) { $scope.value = 'Test'; }]); })();
<div ng-app="dashBoardApp"> <div ng-controller="dashBoardController"> <p>{{5+5}}</p> </div> </div>
I must be doing something stupid. 我一定在做蠢事。 But unable to figure out.
但无法弄清楚。
You need to add a reference to the angular lib 您需要添加对角度库的引用
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
Then it works like a charm 然后它就像一个魅力
(function () { var app = angular.module('dashBoardApp', []); console.log(app); var xx = app.controller('dashBoardController', ['$scope', function ($scope) { $scope.value = 'Test'; }]); })();
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <div ng-app="dashBoardApp"> <div ng-controller="dashBoardController"> <p>{{5+5}}</p> </div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.