Skip to content

Instantly share code, notes, and snippets.

@ryanto
Created February 19, 2018 22:21
Show Gist options
  • Save ryanto/c8bd2ac43e0a70211b7331c066a04b65 to your computer and use it in GitHub Desktop.
Save ryanto/c8bd2ac43e0a70211b7331c066a04b65 to your computer and use it in GitHub Desktop.
typeof DS.attr('number')
import Ember from 'ember';
export default Ember.Component.extend({
store: Ember.inject.service(),
didInsertElement() {
let store = this.get('store');
let model = store.createRecord('my-model');
this.set('model', model);
model.set('age', '21');
this.set('type', (typeof model.get('age')));
console.log(model.get('age'), (typeof model.get('age')));
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
age: DS.attr('number')
});
the age is {{model.age}} (a {{type}})
{
"version": "0.13.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment