Пример #1
0
  startup: function() {
    this.attr('locationProvider', locationProvider);

    //render the template
    $('#app').html(can.view(template, this));

    //on location found update the app content
    can.viewModel('#locator').on('location-found', this.handleLocation.bind(this));

    //on suggestions found reset the app content
    can.viewModel('#locator').on('suggestions-found ', this.handleSuggestions.bind(this));

    //set up routing
    can.route(':location/:x/:y');
    can.route.ready();
    can.route.bind('change', this.routeChange.bind(this));
    this.attr('address', can.route.attr());

    //fix an issue with map stretching when steal builds the app
    setTimeout(function() {
      var maps = can.$('ol-map');
      maps.each(function(index, node) {
        var viewModel = can.$(node).viewModel();
        viewModel.attr('mapObject').updateSize();
      });
    }, 500);
  },
Пример #2
0
	beforeEach: function () {
		template = can.stache('<bitstrap-dropdown items="{items}" button-label="test"></bitstrap-dropdown>');
		$('#qunit-fixture').append(template({}));
		$component = $('bitstrap-dropdown',$('#qunit-fixture') );
		vm = can.viewModel($component);
		
		var items = new can.List([{label:'test'},{label:'hello'}]);
		
		vm.attr('items', items);
	}