파일에
이이 지침의 지시를 포함하는 파일에 대한 내 코드/locationBtn.js
define(['Zf2NVIApp'], function (Zf2NVIApp) {
'use strict';
Zf2NVIApp.directive('locationBtn', function() {
return {
template: '<div></div>',
restrict: 'E',
link: function postLink(scope, element, attrs) {
console.log("we are in the location btn module");
element.text('this is the locationBtn directive');
}
};
});
});
이 코드입니다. 당신의 'Zf2NVIApp.js'파일 당신은 당신의 지시 AMD 모듈 정의의 값을 반환해야보다
define(['angular'], function(angular){
return angular.module('Zf2NVIApp', []);
});
포함되어 있음을 감안할 때 작동한다 :
define(['Zf2NVIApp'], function (Zf2NVIApp) {
'use strict';
Zf2NVIApp.directive('locationBtn', function() {
return {
template: '<div></div>',
restrict: 'E',
link: function postLink(scope, element, attrs) {
console.log("we are in the location btn module");
element.text('this is the locationBtn directive');
}
};
});
// You need to return something from this factory function
return Zf2NVIApp;
});
그래, 그 트릭을했다. –