These are chat archives for AngularClass/NG6-starter

4th
Jan 2016
Joe Gatt
@joegatt
Jan 04 2016 14:35
What's the best way of implementing custom filters? I've tried following AngularClass/NG6-starter#40 but I have problems...
Sergey Protko
@fesor
Jan 04 2016 15:03
what problem?
IMO the best way to make filters with ES6 - it pretty the same as for ES5
you don’t need classes. Only functions. Angular filters suppose to be pure-functions
export default function () {

    return function (text = '') {
        return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
    }
}
Sergey Protko
@fesor
Jan 04 2016 15:09
Added comment on issue