在.js文件中分离AngularJS时,KendoUI停止工作
我正在尝试用KendoUi+AngularJs做一个简单的项目 当我使用下面的代码时,它工作正常:在.js文件中分离AngularJS时,KendoUI停止工作,angularjs,kendo-ui,Angularjs,Kendo Ui,我正在尝试用KendoUi+AngularJs做一个简单的项目 当我使用下面的代码时,它工作正常: <!DOCTYPE html> <head> <title>AngularJS</title> <meta charset="utf-8"> <link href="Content/kendo/2014.2.716/kendo.common.min.css" rel="stylesheet" />
<!DOCTYPE html>
<head>
<title>AngularJS</title>
<meta charset="utf-8">
<link href="Content/kendo/2014.2.716/kendo.common.min.css" rel="stylesheet" />
<link href="Content/kendo/2014.2.716/kendo.rtl.min.css" rel="stylesheet" />
<link href="Content/kendo/2014.2.716/kendo.default.min.css" rel="stylesheet" />
<script src="Scripts/kendo/2014.2.716/jquery.min.js"></script>
<script src="Scripts/kendo/2014.2.716/angular.min.js"></script>
<script src="Scripts/kendo.all.min.js"></script>
</head>
<body>
<a class="offline-button" href="../index.html">Back</a>
<div id="example" ng-app="KendoDemos">
<div class="demo-section k-content" ng-controller="MyCtrl">
<div class="box-col">
<h4>Set Value</h4>
<p>
<input kendo-numeric-text-box k-min="0" k-max="100" k-ng-model="value" />
</p>
</div>
<div class="box-col">
<h4>Set Value</h4>
<div kendo-slider k-min="0" k-max="100" k-ng-model="value"></div>
</div>
<div class="box-col">
<h4>Result</h4>
Value: {{value}}
</div>
</div>
</div>
<script>
angular.module("KendoDemos", ["kendo.directives"]);
function MyCtrl($scope) {
$scope.value = 50;
}
</script>
</body>
</html>
我做错了什么
关于您似乎没有将控制器添加到文件中 下面是外部.js文件的代码:
angular.module("MyApp", ["kendo.directives"]);
function MyCtrl($scope) {
$scope.value = 50;
}
下面是一个工作示例:
(function() {
var itensApp = angular.module('KendoDemos', ["kendo.directives"]);
}());
angular.module("MyApp", ["kendo.directives"]);
function MyCtrl($scope) {
$scope.value = 50;
}