Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在.js文件中分离AngularJS时,KendoUI停止工作_Angularjs_Kendo Ui - Fatal编程技术网

在.js文件中分离AngularJS时,KendoUI停止工作

在.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" />

我正在尝试用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" />
    <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;
}