I am new in angular js.
my array -
"cards":[
"xxx Bank Credit Card",
"yyy Bank Debit Card"
],
what i am tring get only xxx adn yyy or Credit and Debit from the string .I am using angular js 1.2.23 .
I am new in angular js.
my array -
"cards":[
"xxx Bank Credit Card",
"yyy Bank Debit Card"
],
what i am tring get only xxx adn yyy or Credit and Debit from the string .I am using angular js 1.2.23 .
Try this
angular.module('myModule', [])
.filter('split', function() {
return function(input, splitChar, splitIndex) {
// do some bounds checking here to ensure it has that index
return input.split(splitChar)[splitIndex];
}
});
Use in view like
{{test | split(',',0)}}
Ref - See here
You can even use default Filter of Angular Js " limitTo() " . it is very helpful but not a splitter , https://docs.angularjs.org/api/ng/filter/limitTo
in your case you can use it like {{cards[0] | limitTo(3) }} =xxx