Hi I'm trying to separate the code of a custom directive to manage checkboxes to a different file, but is not working and also it seems that is not loading when I debug with devtools I'm not able to see this new file.
not.js
(function () {
'use strict';
var sn = angular.module('notApp');
sn.controller('notController', ['$scope', '$window', '$timeout', 'dataContext', notController]);
function notController($scope, $window, $timeout, dataContext) {
}
sn.directive('checkList', function () {
return {
};
});
})();
notApp.js
(function () {
'use strict';
angular.module('templates-notHtml', []);
angular.module('notApp', [
'templates-notHtml'
]);
})();
notDataContext.js
(function () {
'use strict';
var sn = angular.module('notApp');
var dataContext = sn.service('dataContext', ['$http', '$window', '$rootScope', dataContextFunction]);
function dataContextFunction($http, $window, $rootScope) {
this.getPeriods = function () {
return $http({
method: 'GET',
url: '..........'
}).then(function (success) {
return success;
});
};
}
})();
not.html
<div ng-app="notApp">
<div id="sn" data-ng-controller="notController" class="mainDiv">
</div>
</div>
<script src="not.js"></script>
In this way the directive is working fine but when I separate the directive to another file, for example to customDirectives.js:
customDirectives.js
var sn = angular.module('notApp');
sn.directive('checkList', function () {
return {}
};
});
and then adding the script reference of customDirectives.js in not.html like:
not.html
<div ng-app="notApp">
<div id="sn" data-ng-controller="notController" class="mainDiv">
</div>
</div>
<script src="not.js"></script>
<script src="customDirectives.js"></script>
Stops working by this way, and also I'm not able to see customDirectives.js loaded in Chrome.
Any idea on what I'm doing wrong?