angularjs - How do I trigger an Angular custom filter on click and populate with the filtered data? -


I want that .prerequisites container to be shown and populated, only when .popPrereq link (which can be a button ) Is clicked on.

Jason data is already available in the main controller and the filter works fine. To populate the data that clicked, I need to tell in just one way.

  & lt; A href = "#" data-ng-show = "course.CoursePrerequisites" class = "popPrereq" & gt; Prerequisites & lt; / A & gt; & Lt; Div class = "prerequisites" style = "background: pink" & gt; & Lt; Div class = "prerequisite" data-ng-repeat = "pre-requisites in courses | requirements received: course. Course dependency" & gt; & Lt; P & gt; {{Prerequisite.program}} & lt; Br> & Lt; B & gt; {{Prerequisite.pagetitle}} & lt; / B & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

This is my custom filter

  Courses SearchApp.filter ('getrerequisites', function () {return work (prerequisites, id) {var searchIds = IDs .split (','); var for start-up = []; for (var i = 0; i & lt; retrospective length; i ++) {if (searchIds.indexOf (i.e.. prefixes [i]. Id) = 1) {arrayToReturn Push (Prerequisites [i]);}} Returning Surrender Norton;};});   

thanks

pop-up hyperlink < Code> ngClick instructions where to set the Show / Hide status for the container. And add the ngif directive to something else with this value.

  & lt; A href = "#" data-ng-show = "course.CoursePrerequisites" data-ng-click = "show_prompos = true" square = "popprinic" & gt; Prerequisites & lt; / A & gt; & Lt; Div data-ng-if = "showPrerequisites" category = "prerequisites" style = "background: pink" & gt; & Lt; Div class = "prerequisite" data-ng-repeat = "pre-requisites in courses | requirements received: course. Course dependency" & gt; & Lt; P & gt; {{Prerequisite.program}} & lt; Br> & Lt; B & gt; {{Prerequisite.pagetitle}} & lt; / B & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -