Is it possible to use something similar to {{mystr | split(last) }}
somehow?
I\'m hoping there is a pipe included already.
You need a custom pipe for this. You could implement this this way:
@Pipe({
name: 'split'
})
export class SplitPipe implements PipeTransform {
transform(val:string, params:string[]):string[] {
return val.split(params[0]);
}
}
and use it like this:
{{mystr | split:last }}
where last
is a property of your component that corresponds to the separator.