javascript - What is the equivalent method in Angular 2 of Angular $.grep() method? -


how can refactor code using angular 2 methods? not find on google.

var tooltipsdata = $.grep(tooltips, function (element, index) {     return (element.productcode == productcode); }); 

looks trying implement without jquery (angular 2 still javascript (or typescript)). if trying implement in js, use array.filter function

var tooltipsdata = tooltips.filter(function (element, index) {    return (element.productcode === productcode); }); 

Comments