In guide I can find:
" If you are embedding an Ember application into an existing site, you can have event listeners set up for a specific element by providing a rootElement property:
window.App = Ember.Application.create({
rootElement: '#sidebar'
});
"
Please give me example how to use it corretly.
HTML
<script type="text/x-handlebars" data-template-name="app-view">
My ember app view
</script>
This is a static content
<div id="app-container"></div>
This is a static content
JS
App = Ember.Application.create({
rootElement: '#app-container'
});
App.ApplicationController = Ember.Controller.extend();
App.ApplicationView = Ember.View.extend({
templateName: 'app-view'
});
App.Router = Ember.Router.extend({
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/',
connectOutlets: function (router) {
// do some stuff here...
}
})
})
});
App.initialize();
Here is the JSFiddle: http://jsfiddle.net/MikeAski/xtzNB/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With