Environment is backbone!
The first thing to declare:
1 handlebars.registerhelper ('roomnamedisplayfunction(flag) {2 return flag? ' Roomname-hide ': '; 3 });
Calls in the template:
var Secretlist = Fliza. List.extend ({... ...). Other code ' <a class= ' fromroom {{roomnamedisplay roomnamehide}} ' target= ' _blank ' >[{{rooname} }]</a> ' + ...... Other code });
In the model (data) logical processing:
Roomnamehide:v.from_client_roomname = = RoomConfig.roominfo.room_name
Review the process:
1, first with registerhelper registered a roomnamedisplay helper, receive a flag parameter. Returns the string ' Roomname-hide ' or ' in accordance with the true or False flag ;
2. In the model (data), use variable roomnamehide to store the value of two data is equal.
3, in the template call registered Roomnamedisplay Helper, the template roomnamehide will be based on the values in the model according to the settings in the declaration to compile.
All this, like the very declaration function, the argument call!
Handlebars How to use custom helper