javascript - angularjs injecting partial view from controller -


inside angularjs app view page have unordered list like

<ul>    <li> item 1 </li>    <li> item 2 </li>    <li> item 3 </li> </ul> 

on same page have placeholder want load partial views content returned controller

<div id="partialresults"> </div> 

i thinking onclick on each iteam call controller function , return partial view controller view.

how can in angularjs or there better way situations. way in asp.net-mvc sending ajax request , return partial view controller.

something should work. call function in controller html view want include:

<li ng-click='loadpartial("item1.html")'> item 1 </li> 

then in controller set active in variable:

$scope.loadpartial = function(link) {     $scope.currentpartial = $scope.basepath + link; } 

then in div:

<div id="partialresults" ng-include="currentpartial"> </div> 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -