0
I am trying to create a simple project of Kendoui + Angularjs. When I use the code below, everything works normal:
<!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>
But when I try to separate the Angularjs code into a file .js
separate (as shown at the end), the page stops working (in relation to 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>
<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>
Scripts/itensApp.js
(function() {
var itensApp = angular.module('KendoDemos', ["kendo.directives"]);
}());
Console:
Error: [ng:areq] http://errors.angularjs.org/1.2.16/ng/areq?p0=MyCtrl&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
at http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:6:450
at xb (http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:18:360)
at Ra (http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:18:447)
at http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:66:96
at http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:53:14
at q (http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:7:386)
at J (http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:52:382)
at f (http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:46:399)
at f (http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js:46:416) angular.min.js:89
GET http://localhost:10642/scripts/kendo/2014.2.716/angular.min.js.map 404 (Not Found)
What am I doing wrong?
Murphy, try to give your questions descriptive headlines, "Help with simple design" doesn’t mean much. I did the best performance I could, so feel free to adjust.
– brasofilo
Thank you Brasofilo.
– Eduardo
Murphy, in the second case, where is the statement of his
Controller
? In the browser console some error is displayed?– Wakim
Wakim, I’ve updated the console data.
– Eduardo