vigour-modal
v1.0.5
Published
[](http://standardjs.com/) [](https://badge.fury.io/js/vigour-modal) [
var Data = new Observable({
inject: require('vigour-observable/lib/data'),
Child: 'Constructor'
}).Constructor
// define some modals
var modalData = new Data({
firstModal: {
title:'one modal',
buttons: {
goToOtherModal: ['$', 'modals', 'secondModal'] // reference to secondModal field
}
},
secondModal: {
title:'another modal',
buttons: {
goToOtherModal: ['$', 'modals', 'firstModal'] // reference to firstModal field
}
}
})
// define your navigation data
var navigation = new Data({
state:{
modal:{
// this is the field your modals will set when navigating
current: modalData.firstModal
}
}
})
// add modal component to your app
var app = e({
components: {
modal: require('vigour-modal')
},
DOM: document.body
})
// add your modal switcher
app.set({
myModalSwitcher: {
type:'modal'
}
})
// add your data
app.val = navigation