0
角度起動ストラップにアプリケーション固有の機能を追加する必要があります。確認はdirectiveです。角度ブートストラップ確認指示を延長する
私は自分のコードで直接簡単に使うことができますが、自分のディレクティブを作成して使用しようとすると、モジュールインジェクタエラーが発生します。
Error: [$injector:unpr] http://errors.angularjs.org/1.5.8/$injector/unpr?p0=mwlConfirmProvider%20%3C-%20mwlConfirm%20%3C-%20myDirective
グローバル宣言
angular.module('myModule',
[
'ui.bootstrap',
'ngSanitize',
'mwl.confirm'
]);
指令は
angular
.module('myModule')
.directive('myDirective', directive);
directive.$inject = ['mwlConfirm'];
function directive(mwlConfirm) {
return {
restrict: 'A',
link: linkFunction
};
function linkFunction(scope, element, attrs) {
//code removed for brevity
var confirmOptions = ...
...
...
mwlConfirm.value('confirmationPopoverDefaults', confirmOptions);
}
}
コードで何が悪いのでしょうか?
ディレクティブを挿入できません。 [ディレクティブ拡張の理解](https://github.com/angular/angular.js/wiki/Understanding-Directives#extending-directives)を参照してください。 – charlietfl