compile error, accordion controller required

后端 未结 4 1468
长发绾君心
长发绾君心 2021-01-18 06:04

I met following error in the console when using angular-bootstrap ui. I have angular 1.2.6, bootstrap 3.0, and angular-bootstrap 0.10.0.

Err

4条回答
  •  执笔经年
    2021-01-18 06:26

    From the code you have provided, you aren't including enough of the required code from ui-bootstrap.

    This looks like the minimum of what you need and why the compiler is giving the error.

      
        
          This content is straight in the template.
        
      
    

    This is straight off the ui-bootstrap site... accordion section.

    You can see that in the accordion group directive's code that the accordion is required...

    From github:

    // The accordion-group directive indicates a block of html that will expand and collapse in an accordion
    .directive('accordionGroup', function() {
      return {
        require:'^accordion',         // We need this directive to be inside an accordion
        restrict:'EA',
        transclude:true,              // It transcludes the contents of the directive into the template
        replace: true,                // The element containing the directive will be replaced with the template
        templateUrl:'template/accordion/accordion-group.html',
        scope: {
          heading: '@',               // Interpolate the heading attribute onto this scope
          isOpen: '=?',
          isDisabled: '=?'
        },
        controller: function() {
          this.setHeading = function(element) {
            this.heading = element;
          };
        },
        link: function(scope, element, attrs, accordionCtrl) {
          accordionCtrl.addGroup(scope);
    
          scope.$watch('isOpen', function(value) {
            if ( value ) {
              accordionCtrl.closeOthers(scope);
            }
          });
    
          scope.toggleOpen = function() {
            if ( !scope.isDisabled ) {
              scope.isOpen = !scope.isOpen;
            }
          };
        }
      };
    })
    

提交回复
热议问题