html - Get item from ng-repeat list using Angular -
i'm making project list made search result. build
<div class="col-lg-6"> <ul ng-repeat=" wiks in wiki"> <li ng-mouseenter="abstract = wiks.abstract" ng-mouseleave="abstract = ''"> <a href="#/view2">{{wiks.title}}</a> </li> <p>{{abstract}}</p> </ul> </div>
the wiks object has more title , abstract in it. reduce amount of calls server i'd save object in variable in controller next view.
.controller('view1ctrl',['$scope','wikifactory' , function($scope, wikifactory) { $scope.title = "wiki search site"; $scope.search = ""; $scope.wiki= ""; $scope.getwiki= function getwiki() { wikifactory.getwiki($scope.search) .success(function (wiki) { $scope.wiki = wiki; })} }]) .controller('wikicontroller', ['$scope','wikifactory', function($scope , $wikifactory){ }])
so i've tried make $scope.specifiedwik in view1ctrl cant seem find out how wiks click on. when problem solved wonder wether or not ok "the big book og programming law" call $scope.wiki = $scope.$parent.specifikwiki in new controller?
thanks if can help
i store object in factory available other controller(s).
<li ng-click="selectwiki(wiks)">
in controller:
$scope.selectwiki = function(wiki){ wikifactory.selected = wiki; }
now when other controller loads can like:
$scope.selected = wikifactory.selected;
Comments
Post a Comment