Created
July 21, 2016 23:46
-
-
Save dallarosa/daaac2d8959026a05c1eef1d65493d6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
. | |
. | |
<link rel="import" href="../bower_components/app-localize-behavior/app-localize-behavior.html"> | |
. | |
. | |
. | |
<a name="view1" href="/view1">{{localize('hello','a','Batman')}}</a> | |
. | |
. | |
. | |
<script> | |
Polymer({ | |
is: 'my-app', | |
behaviors: [ | |
Polymer.AppLocalizeBehavior | |
], | |
properties: { | |
language: { | |
value: 'en' | |
} | |
}, | |
resources: { | |
value: function() { | |
return { | |
'en': { 'hello': 'My name is {name}.' }, | |
'fr': { 'hello': 'Je m\'apelle {name}.' } | |
} | |
} | |
}, | |
page: { | |
type: String, | |
reflectToAttribute: true, | |
observer: '_pageChanged' | |
}, | |
observers: [ | |
'_routePageChanged(routeData.page)' | |
], | |
_routePageChanged: function(page) { | |
this.page = page || 'view1'; | |
}, | |
_pageChanged: function(page) { | |
// load page import on demand. | |
this.importHref( | |
this.resolveUrl('my-' + page + '.html'), null, null, true); | |
} | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment