json 在safari中的Ember数据错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json 在safari中的Ember数据错误相关的知识,希望对你有一定的参考价值。

import DS from 'ember-data';
export default DS.FixtureAdapter;
import Ember from 'ember';

export default Ember.Controller.extend({
  appName:'Ember Twiddle',
  actions: {
  	register() {
      const _this = this;
    	_this.model.save().then(function(){
      	_this.transitionToRoute('login');
      }, function(errors) {
        console.log('/!\\ Issue is here: /!\\');
      	console.log(errors);
      });
    }
  }
});
import Ember from 'ember';

export default Ember.Controller.extend({
});
import Ember from 'ember';
import DS from 'ember-data';

var attrs = [
	'firstName',
  'lastName',
  'email',
  'password',
  'passwordConfirmation'
];

export default DS.Model.extend({
  firstName: DS.attr('string'),
  lastName: DS.attr('string'),
  email: DS.attr('string'),
  phoneNumber: DS.attr('string'),
  password: DS.attr('string'),
  passwordConfirmation: DS.attr('string'),
  
  passwordsMatch: Ember.computed('password', 'passwordConfirmation', function() {
  	return this.get('password') === this.get('passwordConfirmation');
  }),
  
  filledIn: Ember.computed(...attrs, () => {
  	let ret = true;
    attrs.forEach((item) => { if (!this.get(item)) { ret = false; } });
    
    return ret;
  })
});
import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('register'),
  this.route('login')
});

export default Router;
import Ember from 'ember';

export default Ember.Route.extend({
  model() { return this.store.createRecord('register'); }
});
{{#link-to 'register'}}Register{{/link-to}}
<br/>
{{outlet}}
If you see this then everything is working.
{
  "version": "0.4.8",
  "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
    "ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.8/ember.js",
    "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.9/ember-data.js",
    "ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.8/ember-template-compiler.js",
    "ember-localstorage-adapter": "https://github.com/kurko/ember-localstorage-adapter/blob/master/localstorage_adapter.js"
  }
}

以上是关于json 在safari中的Ember数据错误的主要内容,如果未能解决你的问题,请参考以下文章

JSON响应中的Ember嵌套数据

Ember Cli在窗户上

从ember数据json中删除模型名称

ember中Could not find module `ember` imported from `mgapp/app问题解决

Ember 数据 JSON-RPC 请求示例

css Ember.js模型生成器 - 将JSON对象反向工程为Ember数据模型