vue-route-rx
v1.0.1
Published
Make $route observable for Vue
Downloads
17
Readme
vue-route-rx
Create observable from vue-router to work with vue-rx subscriptions
Installation
NPM + ES2015
npm install vue vue-router vue-rx rxjs vue-route-rx --save
import Vue from 'vue'
import VueRouter from 'vue-router'
import { Observable, Subscription, BehaviorSubject } from 'rxjs'
import VueRx from 'vue-rx'
import VueRouteRx from 'vue-route-rx'
Vue.use(VueRouter)
Vue.use(VueRx, { Observable, Subscription })
Vue.use(VueRouteRx, { BehaviorSubject })
const router = new VueRouter(...)
VueRouteRx.use(router)
Global Script
Includes vue-route-rx after Vue.js and RxJS
Usage
Vue.component('foo', {
subscriptions () {
return {
msg: this.$$route
.flatMap((route) => Message.get(route.params.id))
}
}
})