I have a controller object that\'s like:
MyApp.objController = Ember.ArrayController.create({
init: function(data) {
data.isValid = function() {
retu
Try this:
{{#each subsites}}
{{#if this}}
- {{{WhatIsTheSiteFor this}}}
{{else}}
- no found
{{/if}}
{{/each}}
The helper function WhatIsTheSiteFor
:
Handlebars.registerHelper('WhatIsTheSiteFor', function(siteName) {
var subSiteName = '',
siteNameStr = '';
$.each(siteName, function(i, item) {
siteNameStr += item;
return siteNameStr;
});
if(siteNameStr === 's.gbin1.com') {
subSiteName = 'GB搜索引擎';
}
else if (siteNameStr === 'm.gbin1.com') {
subSiteName = 'GB手机阅读';
}
else if (siteNameStr === 'rss.gbin1.com') {
subSiteName = 'RSS消息订阅';
}
return subSiteName;
});
A demo can be found here: http://www.gbin1.com/gb/networks/uploads/71bb1c1e-0cd3-4990-a177-35ce2612ce81/demo6.html