Quote from
luishp on March 18, 2022, 5:14 pm
I have just discovered this functionality :)
You can use ng-if advanced property to show or hide an object. For example if you add this to ng-if property:
[myvar]=="myvalue"
Then, if [myvar] contains anything different from "myvalue", the object will remain invisible.
Additionaly you can create a subroutine and send a parameter to it. If the subroutine returns true, the object will be shown.
I mean you can add this code directly into ng-if property too:
mysubroutine([myvar]);
For ng-bind-html is exactly the same, but the subroutine can return any HTML content. For example imagine you send [data] to the subroutine, just like this:
mysubroutine([mydata])
And then the subroutine gets the parameter as [data] and returns an HTML string just like this:
return "Hello <b>[data]</b>"
Then the object content will show:
Hello Value.
This is very useful to format content from a database or JSON using ng-repeat.
I hope you find it as useful as myself.
I have just discovered this functionality :)
You can use ng-if advanced property to show or hide an object. For example if you add this to ng-if property:
[myvar]=="myvalue"
Then, if [myvar] contains anything different from "myvalue", the object will remain invisible.
Additionaly you can create a subroutine and send a parameter to it. If the subroutine returns true, the object will be shown.
I mean you can add this code directly into ng-if property too:
mysubroutine([myvar]);
For ng-bind-html is exactly the same, but the subroutine can return any HTML content. For example imagine you send [data] to the subroutine, just like this:
mysubroutine([mydata])
And then the subroutine gets the parameter as [data] and returns an HTML string just like this:
return "Hello <b>[data]</b>"
Then the object content will show:
Hello Value.
This is very useful to format content from a database or JSON using ng-repeat.
I hope you find it as useful as myself.
Vadim, Ivanes82 and 3 other users have reacted to this post.
VadimIvanes82CDY@44smartmediaroccocogliano