2014-09-12 41 views
0

我試圖用KendoUi + AngularJs做一個簡單的項目。當單獨的AngularJS在.js文件中時KendoUI停止工作

當我使用下面的代碼,它工作正常:

<!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文件中,(像下圖),它不工作了:

<!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> 
    <script src="Scripts/app/itensApp.js"></script> <!--ADDED--> 
</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> 
</body> 
</html> 

腳本/ itensApp.js

(function() { 
    var itensApp = angular.module('KendoDemos', ["kendo.directives"]); 
}()); 

我做錯了什麼?

問候

回答

相關問題