Created
August 25, 2017 21:31
-
-
Save kumkanillam/4acc114017f5b6aeb9b0125d2aae8d98 to your computer and use it in GitHub Desktop.
report rule test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import ReportRule from './../utils/report-rule'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
componentName: true, | |
reportRules: undefined, | |
init(){ | |
this._super(...arguments); | |
this.set('reportRules',[]); | |
}, | |
actions:{ | |
addRule(){ | |
var filters = this.get('reportRules'); | |
console.log('Ember.isEmpty(filters)',Ember.isEmpty(filters)); | |
if (Ember.isEmpty(filters)) { | |
filters = []; | |
let temp={}; | |
temp.id=1; | |
temp.names=['first']; | |
filters.pushObject(ReportRule.create(temp)); | |
this.set('reportRules', filters); | |
} else { | |
let temp={}; | |
temp.id=filters.length+1; | |
temp.names=['Next'+temp.id]; | |
filters.pushObject(ReportRule.create(temp)); | |
} | |
}, | |
deleteRule(index){ | |
if (this.get('reportRules').length > 0) { | |
this.get('reportRules').removeAt(index); | |
// this.get('reportRules').removeObject(index); | |
} | |
console.log(' CurrentRules:', this.get('reportRules')); | |
}, | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Service.extend({ | |
serviceName:'My-Service', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Object.extend({ | |
myService:Ember.inject.service(), | |
id:'', | |
names:[], | |
init(){ | |
this._super(...arguments); | |
console.log(' arg ',this.get('myService'),' name ',this.get('myService.serviceName')); | |
//this.set('names',['init']); | |
//this.set('names',[]); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment