ciochPep
ciochPep

Reputation: 2592

angularjs: how to change a template for a specific ng-view or ng-include?

I have few ng-views and ng-includes in one single page,

I would like to change the template of a specific ng-include upon route change?

Upvotes: 4

Views: 7807

Answers (1)

Mark Rajcok
Mark Rajcok

Reputation: 364707

You'll probably have to use the same template, but within that template, use ng-switch in combination with ng-include to load the appropriate template. Your controller can set some $scope property that ng-switch will use to determine which template to load.

Andy already provided an exmple of such here: https://stackoverflow.com/a/12584774/215945

Upvotes: 2

Related Questions