javascript - Unknown provider: accordionDirectiveProvider -
could me figure out mistake is? used this example build sortable accordion on page. example works well, i've put code app , got error
angular.js:68 uncaught error: [$injector:modulerr] failed instantiate module app due to: error: [$injector:unpr] unknown provider: accordiondirectiveprovider http://errors.angularjs.org/1.5.7/$injector/unpr?p0=accordiondirectiveprovider @ http://localhost:63342/myapp%202.0/libs/angular/angular.js:68:20 @ http://localhost:63342/myapp%202.0/libs/angular/angular.js:4502:27 @ object.getservice [as get] (http://localhost:63342/myapp%202.0/libs/angular/angular.js:4655:53) @ object.decorator (http://localhost:63342/myapp%202.0/libs/angular/angular.js:4577:49) @ http://localhost:63342/myapp%202.0/js/app/app.js:56:18 @ object.invoke (http://localhost:63342/myapp%202.0/libs/angular/angular.js:4709:31) @ runinvokequeue (http://localhost:63342/myapp%202.0/libs/angular/angular.js:4602:49) @ http://localhost:63342/myapp%202.0/libs/angular/angular.js:4611:25 @ foreach (http://localhost:63342/myapp%202.0/libs/angular/angular.js:321:34) @ loadmodules (http://localhost:63342/myapp%202.0/libs/angular/angular.js:4592:13) http://errors.angularjs.org/1.5.7/$injector/modulerr?p0=app&p1=error%3a%20%…localhost%3a63342%2fmyapp%25202.0%2flibs%2fangular%2fangular.js%3a4592%3a13)
as can see line wrong provider
http://localhost:63342/myapp%202.0/js/app/app.js:56:18 @ object.invoke .config(['$provide', function ($provide){ $provide.decorator('accordiondirective', function($delegate) { var directive = $delegate[0]; directive.replace = true; return $delegate; }); }])
but clear code provider, accordion stop working. mistake? apologize cannot catch error in plunker put code below
(function () { window.app = angular.module('app', ['ngroute','nganimate', 'ui.bootstrap', 'ui.sortable', 'ngsanitize', 'ngtouch', 'ui.grid', 'ui.grid.exporter', 'ui.grid.selection', 'ui.grid.pagination', 'ui.grid.savestate', 'ui.grid.cellnav', 'ui.grid.resizecolumns', 'ui.grid.movecolumns', 'ui.grid.pinning', 'ui.grid.grouping', 'ui.grid.autoresize', 'ui.grid.edit', 'ui.grid.rowedit' ]) .run(['$rootscope', function($rootscope) { $rootscope.$on('$routechangesuccess', function (event, current, previous) { $rootscope.title = current.$$route.title; }); }]) .config(['$httpprovider', function ($httpprovider) { $httpprovider.defaults.usexdomain = true; delete $httpprovider.defaults.headers.common["x-requested-with"]; }]) .config(['$routeprovider', function($routeprovider) { $routeprovider .when('/', { title: " ", controller: 'homectrl' }) .when('/page', { title: 'grid', templateurl: 'html/pages/grid.html', controller: 'gridctrl' }) .when('/designer', { title: 'design grid', templateurl: 'html/pages/designer.html', controller: 'designerctrl' }) .otherwise({ redirectto: '/' }); }]) .config(['$provide', function ($provide){ $provide.decorator('accordiondirective', function($delegate) { var directive = $delegate[0]; directive.replace = true; return $delegate; }); }]) .filter('makeuppercase', function () { return function (item) { var space = item.replace(/\./g, " "); var result = space.replace(/([a-z])/g, " $1"); return result.charat(0).touppercase() + result.slice(1) }; }) }());
html
<uib-accordion ui-sortable="sortableoptions" ng-model="panels"> <uib-accordion-group ng-repeat="panel in panels"> <uib-accordion-heading> <div class="handle"><i class="fa fa-arrows pull-left"></i></div> <span class="panel-title-left">{{panel.heading}}</span> <i class="caret pull-right"></i> </uib-accordion-heading> <div ng-include=" panel.url "></div> </uib-accordion-group> </uib-accordion>
this error can if use uib-tools 1.+. in latest version have changed name of directive 'accordion' 'uibaccordion', have use 'uibaccordiondirective'. see example
.config(['$provide', function ($provide){ $provide.decorator('uibaccordiondirective', function($delegate) { var directive = $delegate[0]; directive.replace = true; return $delegate; }); }])
Comments
Post a Comment