AngularJS提供商问题

时间:2016-03-12 17:11:50

标签: angularjs

嘿伙计们,我刚刚在AngularJS项目中整理了一些动画。正在切换的侧边栏是在一个限制为E的指令中。它在本地工作正常但是当我将应用程序放在网上时我得到了这个错误。

    Error: [$injector:unpr] Unknown provider: eProvider <- e
    http://errors.angularjs.org/1.5.0/$injector/unpr?p0=eProvider%20%3C-%20e
    at vendor-db22f3941a.js:11307
    at vendor-db22f3941a.js:15636
    at Object.r [as get] (vendor-db22f3941a.js:15789)
    at vendor-db22f3941a.js:15641
    at r (vendor-db22f3941a.js:15789)
    at i (vendor-db22f3941a.js:15813)
    at Object.a [as invoke] (vendor-db22f3941a.js:15835)
    at f.instance (vendor-db22f3941a.js:21094)
    at $ (vendor-db22f3941a.js:20166)
    at vendor-db22f3941a.js:20470(anonymous function) @ vendor-db22f3941a.js:24475

如果我试图为它们制作动画,我是否应该对指令使用不同的限制?

这是我的代码

指令

(function() {'use strict';

  angular
    .module('bhamDesign')
    .directive('bhamSidebar', bhamSidebar);

  function bhamSidebar(){
    var directive = {
      restrict: 'E',
      templateUrl: 'app/components/sidebar/sidebar.html',
      controller: bhamSidebarController
    };

    return directive;
  }

  function bhamSidebarController($scope){
    var vm = $scope;

    vm.toggle = false;

    vm.toggleSidebar = function () {
        vm.toggle=!vm.toggle;
    };
  }

})();

HTML视图

#sidebar-wrapper(ng-class="{'open': toggle}")
  .toggle-box(ng-click="toggleSidebar()")
    span
    span
    span
  img(src="assets/images/about.jpg")

0 个答案:

没有答案