相关疑难解决方法(0)

Ember模特给json

我正在寻找一种有效的方法将我的Ember对象转换为json字符串,以便在下面的websocket消息中使用它

/*
 * Model
 */

App.node = Ember.Object.extend({
  name: 'theName',
  type: 'theType',
  value: 'theValue',
})
Run Code Online (Sandbox Code Playgroud)

websocket方法:

App.io.emit('node', {node: hash}); 
Run Code Online (Sandbox Code Playgroud)

hash应该是节点的json表示.{name:thename,type:theType,..}必须有一个快速的在线人才能做到这一点.我不想手工做,因为我有很多属性,他们很可能会改变..

javascript ember.js

22
推荐指数
3
解决办法
2万
查看次数

标签 统计

ember.js ×1

javascript ×1