angularjs
2016-11-17 9 views 0 likes 
0

2つのディレクティブがあります。一つは、 "サブディレクティブ"ディレクティブ、必須、角js

主である:

.directive('materialDropdown', function() { 
    // Input to directive 
    return { 
     scope: { 
     //'personalDb': '=', 
     }, 
     transclude: true, 
     controllerAs: 'vm', 
     bindToController: true, 
     controller: function(){ 
     console.log('material directive fires') 

     }, 
     template: '<select></select>', 
     restrict: 'E', 
     link: function(){} 
    }; 

})。

サブ:

.directive('materialSizeDropdown', function() { 
    // Input to directive 
    return { 
     require: '^^materialDropdown', 
     controllerAs: 'vm', 
     transclude: true, 
     bindToController: true, 
     controller: function(){ 
     console.log('hello') 
     }, 
     template: '<h1>fire</h1>', 
     restrict: 'E', 
     link: function(){} 
    }; 

マークアップ:

<material-dropdown> 
    <material-size-dropdown></material-size-dropdown> 
    </material-dropdown> 

materialSizeDropdownは、マークアップには示されていない、そしてコントローラはいずれかの焼成されていません。

どうすれば解決できますか?

+0

私はそれほど多くのディレクティブを使用していませんが、必要に応じて '^^ materialDropdown'の代わりに 'materialDropdown'を使用してください。 –

答えて

0

レンダリングに使用するmaterialDropdown指示文でtemplateオプションを使用しています。したがって、ネストされたディレクティブは決して表示されません。 <select><h1>は有効ではありません。

関連する問題