In my projekt I have a Map with different countries that have different products and different languages. We also have a map with the translations.
I would like to do something like this in the template:
{{vLang[vCountry]}}
I also tried with helpers but could not succeed.
Here is a simplified idea. I hope it explains the problem:
import oneTemplate from 'onetemplate.stache!';
var lang = new can.Map({
"en": {
"book": "book",
"tree": "tree",
"green": "green"
},
"de": {
"book": "Buch",
"tree": "Baum",
"green": "grün"
}
});
var country = can.compute("en");
$('body').html( oneTemplate({
vLang: lang,
vCountry: country
}) );
//stache template onetemplate.stache
{{vLang[vCountry]}}
findAll: require.toUrl( "~/api/agenda/Afspraak" )
can.ajaxPrefilter
I'm trying to simplify some code to a getter that returns a promise:
Viewmodel:
foo: {
get: function () {
return Foo.findAll();
}
}
Stache:
{{#if foo.isPending}}
{{#else}}
...?
{{/}}
new MyModel.List({/*params*/})
which is a promise-like list
can.List
s to be promise-like, so if you return one in a promise, it crashes the app