Last active
July 4, 2018 09:24
-
-
Save gokatz/217b15400a77c7ea9f5f4c2246f086d3 to your computer and use it in GitHub Desktop.
client side data integrity
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.Component.extend({ | |
}); |
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.Controller.extend({ | |
appName: 'Ember Twiddle', | |
data: 'Gokul', | |
boys: [{name: 'Gokul'}, {name: 'Ragul'}, {name: 'Raj'}], | |
girls: [{name: 'Megha'}, {name: 'Rupika'}, {name: 'Priya'}], | |
content: Ember.computed.reads('boys'), | |
selectedType: 'boys', | |
actions: { | |
setArr() { | |
let type = this.get('selectedType'); | |
if(type === 'boys') { | |
this.set('content', this.get('girls')); | |
this.set('selectedType', 'girls') | |
} else { | |
this.set('content', this.get('boys')); | |
this.set('selectedType', 'boys') | |
} | |
}, | |
send() { | |
let selectElement = document.querySelector('select'); | |
let value = selectElement.value; | |
let msg; | |
if(value === this.get('data')) { | |
msg = 'Integrity passed ✔'; | |
} else { | |
msg = "Integrity failed ✘"; | |
} | |
alert(`User sees: ${value} \nUnderlying data: ${this.get('data')} \n${msg}`); | |
} | |
} | |
}); |
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.15.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-data": "3.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment