geblanco / electron-router

Router solving Electron hell callback passing, helpfull for MVC
MIT License
123 stars 6 forks source link

angular 2 #2

Closed yrang closed 7 years ago

yrang commented 7 years ago

Electron-router how to use in the angular 2? thanks

geblanco commented 7 years ago

Hi,

Well first of all, this library is only useful within an Electron project, it doesn't run anywhere else.

Said that, you can use it as you want, I've never used angular, but I suppose you could do as with any other front-end library:

// Require the module
let Router = require('electron-router')
// Get an instance
let router = Router('<whatever name you want>')
// ... and start binding and routing events

The router is a singleton, so you will only have one instance on the backned and one on each window you create.

I think that in some cases, it's also interesting to hook it after the layer that makes requests to the backend too. In my case as I use Backbone, I created another repo just for that.

Regards,

geblanco commented 7 years ago

@yrang ping