Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
146
rated 0 times [  150] [ 4]  / answers: 1 / hits: 25870  / 9 Years ago, tue, june 23, 2015, 12:00:00

Can I bind multiple values using ng-bind like so :



<p ng-bind=instructor.first_name instructor.last_name></p>


Whenever I try this I get the following error:



Error: $parse:syntax Syntax Error



I know I can do the same using the curly braces



<p>{{instructor.first_name}}{{instructor.last_name}}</p>


but I would like to avoid this if I can since the rest of the code base uses ng-bind and I would to stay consistent. Thanks.


More From » angularjs

 Answers
209

You can use + for concatenation of the expressions. The following should work for you: <p ng-bind=(instructor.first_name) + (instructor.last_name)></p>.
You can even add filters there <p ng-bind=(instructor.first_name | filterName) + (instructor.last_name)></p>.


[#66082] Sunday, June 21, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hasancolec

Total Points: 603
Total Questions: 95
Total Answers: 98

Location: South Korea
Member since Sat, Oct 2, 2021
3 Years ago
;