Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script>
  
</head>
<body>
  <script type="text/x-handlebars" data-template-name="application">
    <h1>ember-latest jsbins</h1>
  {{view Ember.Select
contentBinding="controller.users"
multiple="true"
selectionBinding="controller.selectedUsers"
optionLabelPath="content.userId"
optionValuePath="content.userId"
}}
  <div {{action selectUser}} > selectUser</div>
  </script>
  
</body>
</html>
  
 
App = Ember.Application.create({});
App.ApplicationRoute = Ember.Route.extend({
  model: function(){
    return Ember.Object.create({
      users:Em.A([
          {userId: 'Kris', lastName: 'Selden'},
          {userId: 'Luke', lastName: 'Melia'},
          {userId: 'Formerly Alex', lastName: 'Matchneer'}
      ])
    });
  }
});
App.ApplicationController = Ember.ObjectController.extend({
  selectedUsers : function(){
    return [this.get('users')[0]] ;
  }.property('users.@each'),
  actions:{
    selectUser: function(){
      console.log(this);
      console.log(this.get('selectedUsers'));
      this.get('selectedUsers').pushObject(this.get('users')[1]);
    }
  }
});
App.ApplicationView = Ember.View.extend({
  didInsertElement: function(){
    console.log(this.get('controller.selectedUsers'));
  }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers