Angular 2 Markup - if String is empty, display something else

So, in AngularJS in markup there was a way to bind data to a string as follows:

{{myString | 'N/A'}}

That this was done, with one quick click a line was displayed if it was not empty. If it was empty, it would display text behind the pipe.

Now I am using Angular 2 and I am trying to do the same, but I cannot find the syntax for this. Has anyone tried to do this? If so, how can I get around this without having to do this at the component level.

thank

+4
source share
1 answer

Pipe Angular 2, |. || | ( ).

{{myString || 'N/A'}}
+7

Source: https://habr.com/ru/post/1657660/


All Articles