Skip to content

Instantly share code, notes, and snippets.

@eduardonunesp
Created September 25, 2015 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardonunesp/3ac047314cdb043688b5 to your computer and use it in GitHub Desktop.
Save eduardonunesp/3ac047314cdb043688b5 to your computer and use it in GitHub Desktop.
(function() {
'use strict';
new Vue({
el: '#beerApp',
data: {
botecos : [],
openDetails : []
},
ready : function() {
var that = this;
that.$http.get('http://localhost:2403/botecos')
.then(function(result) {
that.$set('botecos', result.data);
})
},
methods: {
doOpenDetails : function(ev, id) {
ev.preventDefault();
var that = this,
index = that.openDetails.indexOf(id);
if (index > -1) {
that.openDetails.$remove(id);
} else {
that.openDetails.push(id);
}
}
}
})
})()%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment