Archive for February, 2015

Access EmberJS Data from a Component

February 11th, 2015 5 Comments

emberjs

 

I am building a small EmberJS application using the Ember-CLI. In the application I have a map that I wanted to load some data to. I ended up picking an Ember Component to control the map so that I could use the didInsertElement method to make sure that my maps markup was ready to be initialized.


//Component called main-map
export default Ember.Component.extend({
	componentMap: '',
	didInsertElement: function() {
		navigator.geolocation.getCurrentPosition(position => {
			//Initialize the map
			this.populateMap();
		});
	},
        populateMap() {
            ...
        }
});

(more…)