javascript - How to use ng-transclude in directives -
i have 2 directives free-form
, free-form-canvas
<div ng-repeat="controls in ctrls"> <free-form></free-form> </div>
free-form.html
<div id="{{controls.uicontrolinstanceid}}"> <free-form-canvas data-controls="controls"></free-form-canvas> </div>
free-form-canvas.html
<div> <!-- ctrl --> <div ng-switch on="ctrl.controlprops[1].containerinstance.uicontainertypeid"> <div ng-switch-when="navigator"> <navigation></navigation> </div> <div ng-switch-when="carousel_view"> <carousel></carousel> </div> <web-tile ng-switch-when="web_tile" class="drag_tiles" tilegroup="tilegroups"> </web-tile> <!-- <news-bulletin data-bulletin="" ng-switch-when="web_bulletin_board"></news-bulletin> --> </div> <floating-options></floating-options> <floating-popup></floating-popup> </div>
but need make transclude free form canvas i.e,
<div ng-repeat="controls in ctrls"> <div id="{{controls.uicontrolinstanceid}}"> <free-form-canvas data-controls="controls"></free-form-canvas> <!-- need include free form canvas here self nothing gets display --> <div> <!-- ctrl --> <div ng-switch on="ctrl.controlprops[1].containerinstance.uicontainertypeid"> <div ng-switch-when="navigator"> <navigation></navigation> </div> <div ng-switch-when="carousel_view"> <carousel></carousel> </div> <web-tile ng-switch-when="web_tile" class="drag_tiles" tilegroup="tilegroups"> </web-tile> <!-- <news-bulletin data-bulletin="" ng-switch-when="web_bulletin_board"></news-bulletin> --> </div> <floating-options></floating-options> <floating-popup></floating-popup> </div> </div> </div>
by using ng-transclude
can solve didn't know how use ng-transclude
.
as noted above new dev
:
you don't need transclude -
<free-form>
has template<free-form-canvas>
, included content of<free-form>
. difference in output have<free-form> <free-form-canvas>....</free-form>
, i.e. output have wrapping<free-form>
, don't have in example, shouldn't matter. if care, use replace: true (although being deprecated).
Comments
Post a Comment