angularjs - How to set the `ng-include` path by dynamically? -


i have content 8 blocks in page. when user clicks on each, opening pop-up , showing same content there. have 8 popup contents separately.

when each of block clicked making view true. according current view, change pop-up (include) content changed. not working.

here pop-up : html:

<div class='ng-modal' ng-if="modal.isopen">     <div class='ng-modal-overlay' ng-click='modal.hide()'></div>         <div class='ng-modal-dialog' ng-style='dialogstyle'>         <div class='ng-modal-dialog-content'>          <ng-include ng-if="modal.board1" src="'../views/projectsummary/modals/{{currentview}}.html'"></ng-include>          {{currentview}} //it works!         </div>     </div> </div> 

in controller setting :

$scope.currentview = "board1"; 

so, html let load :

'../views/projectsummary/modals/board1.html' 

click here see error :

it's better/cleaner set url of partial in controller, becomes non-issue , do:

<ng-include src="currentviewurl"> 

but answer question:

<ng-include src="'../views/projectsummary/modals/' + currentview + '.html"> 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -