Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html>
<body>
  <script type="text/x-handlebars" id="organization">
  <b><a href="http://stackoverflow.com/q/18412257/733034">Refresh problem</a></b>
  <p>
   add some offices: <br />
    Office Name {{view Ember.TextField valueBinding='newoffice'}}
   <br />
   <button {{action "createOffice"}}>Add office</button>
   
    <br />
  
    Here are the Offices:
    <ul>
    {{#each officelist}}
      <li>{{officename}} 
  <button {{action "actionTest" "hello" "goodbye" officename}}>See parameters through action in the console</button></li>
    {{/each}}
    </ul>
    
  </p>
  
  </script>
  
  <script src="http://emberjs.com.s3.amazonaws.com/getting-started/jquery.min.js"></script>
  <script src="http://emberjs.com.s3.amazonaws.com/getting-started/handlebars.js"></script>
  <script src="http://emberjs.com.s3.amazonaws.com/getting-started/ember.js"></script>
  <script src="http://emberjs.com.s3.amazonaws.com/getting-started/ember-data.js"></script>
  <script src="http://emberjs.com.s3.amazonaws.com/getting-started/local_storage_adapter.js"></script>
</body>
</html>
 
window.App = Ember.Application.create({
  LOG_TRANSITIONS: true
});
App.Router.map(function(){
  this.resource('organization', {path: '/'});
});
App.Store = DS.Store.extend({
  revision: 12,
  adapter: DS.LSAdapter.create({
  namespace: 'app-emberjs'
  })
});
App.OrganizationRoute = Ember.Route.extend({
  model: function() {
    return App.Org.find();
  }
});
App.OrganizationController = Ember.ObjectController.extend({
    createOffice: function(){
        var newoffice = App.Office.createRecord({
          officename: this.get('newoffice'),
          org_id: 'myorgid'
        });
        newoffice.save();
        this.set('newoffice', '');
    },
    actionTest: function(a, b, c){
       console.log(a);
       console.log(b);
       console.log(c);
    },
  
    officelist: function(){
      return App.Office.find();
    }.property('content.@each')
  
  
});
App.Org = DS.Model.extend({
   orgname: DS.attr('string')
});
App.Office = DS.Model.extend({
   officename: DS.attr('string'),
   org_id : DS.attr('string')
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers