angularjs - how to refresh ng-include on ng-click -


i load , pass parameters ng-include.

and when user clicks on button, reload same ng-include parameter.

it's not working now. idea how make work ?

here code : http://plnkr.co/edit/marr00jw2k2eu2rp3qr6

html :

<div ng-controller="listctrl">     <button class="btn" type="button" ng-click="loadlist(a)">a</button>     <button class="btn" type="button" ng-click="loadlist(b)">b</button>     <div ng-include="'tpllist.html'" onload="loadlist(0)"></div> </div> 

js:

angular.module('myapp', ['myapp.services', 'myapp.controllers']);  angular.module('myapp.services', ['ngresource']).     factory('list0', function($resource){     return $resource('list0.json');     }).     factory('list1', function($resource){         return $resource('list1.json');     }).     factory('list2', function($resource){         return $resource('list2.json');     });  angular.module('myapp.controllers', []). controller('listctrl', ['$scope', 'list1', 'list2', function($scope, list1, list2) {     $scope.loadlist = function (param) {         if (param === 'a') {              $scope.elms = list1.query();          } else if (param === 'b') {             $scope.elms = list2.query();          } else {             $scope.elms = list0.query();         }     } }]); 

you there, need pass a, b string this

<button class="btn" type="button" ng-click="loadlist('a')">load list 1</button> <button class="btn" type="button" ng-click="loadlist('b')">load list 2</button> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -