I do not understand why I have been getting this error on my ItemView.
Here is my main.js
require.config({
baseUrl: '/',
paths: {
jquery: 'scripts/lib/jquery/jquery.min',
backbone: 'scripts/lib/backbone/backbone.min',
underscore: 'scripts/lib/underscore/underscore-min',
//Core Libraries
marionette: 'scripts/lib/marionette/marionette.min',
text: 'scripts/lib/text/text',
async :'scripts/lib/async'
},
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_'
},
backbone: {
deps: [ 'underscore', 'jquery' ],
exports: 'Backbone'
},
marionette : {
deps : ['jquery', 'underscore', 'backbone'],
exports : 'Marionette'
}
}
});
require([
'jquery',
'underscore',
'backbone',
'marionette'
], function () {
// create the app
var App = new Marionette.Application();
App.addRegions({
map : '#Map'
});
App.addInitializer( function() {
var self = this;
require(['scripts/views/map']
, function(MapView){
self.map.show( new MapView() );
});
});
App.start();
window.App = App;
});
then here is my maps.js
define([
'jquery',
'underscore',
'text!scripts/templates/map.html',
'async!https://maps.googleapis.com/maps/api/js?v=3&sensor=true'
], function($, _, mapTemplate) {
var MapView = Marionette.ItemView.extend({
template: _.template( mapTemplate ),
ui: {
mapContainer: '#map-container'
},
onRender: function() {
var self = this;
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(this.ui.mapContainer, mapOptions);
}
});
return MapView;
});
I'm new to backbone and marionette so I am not sure why I am getting the error of:
Uncaught TypeError: undefined is not a function on this line:
self.map.show( new MapView() );