Created
September 25, 2015 18:53
-
-
Save eduardonunesp/3ac047314cdb043688b5 to your computer and use it in GitHub Desktop.
This file contains 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
(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