xud6的笔记本
  • 主页
  • Centos
  • SELinux
  • FreeIPA
  • node.js
  • ember.js
  • Hyper-V
  • Windows
  • Embedded
  • Linux
  • 树莓派
  • MACOS
Subscribe
Tagged

ember

A collection of 2 posts

ember

让部分ember-data属性不保存到服务器

在ApplicationSerializer中添加 App.ApplicationSerializer = DS.RESTSerializer.extend({ serializeAttribute: function(record, json, key, attribute) { if (!attribute.options.readOnly) { return this._super(record, json, key, attribute); } } }); 然后再其他model中就可以 App.User = DS.Model.create({ admin: DS.attr('boolean', { readOnly: true }) })

  • xud6
xud6 2015年7月7日 • 1 min read
ember

ember 在加载页面后执行js方法

在合适的地方加入一下代码 Ember.run.scheduleOnce('afterRender', this, afterRenderEvent); afterRenderEvent : function(){ // implement this hook in your own subclasses and run your jQuery logic there } 可以加在model上 也可以加在view上 App.YourView = Ember.View.extend({ didInsertElement : function(){ this._super(); Ember.run.scheduleOnce('afterRender', this, function(){ // perform your jQuery logic here }); } }); 也可以重写view对象(对所有view有效) Ember.View.reopen({ didInsertElement

  • xud6
xud6 2014年12月4日 • 1 min read
xud6的笔记本 © 2022
Powered by Ghost