Monday 15 February 2010

javascript - Dynamically loading views / controllers in Angular JS -



javascript - Dynamically loading views / controllers in Angular JS -

we developing configuration tool using angular.js. gui contains 2 sections - left panel contains tree view, list configuration items , right panel contains screens using configuration items can edited . there 6 or 7 different types of configuration items , each of them contains different views...

currently have single view , controller because single api phone call fetches data. each configuration screen div tag shown / hidden tree node clicked... code becoming more cluttered... there way separate each configuration screen separate view / controller , dynamically out using routing

what ng-include?

<div ng-include="view1.html" ng-if="selected == 1"> <div ng-include="view2.html" ng-if="selected == 2"> <div ng-include="view3.html" ng-if="selected == 3">

and in each html u can specify own controller etc.

javascript angularjs controller

No comments:

Post a Comment