This repository has been archived by the owner on Dec 19, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Not able to instantiate router #9
Comments
try moving the Thanks for pointing out the typo 👍 |
I see the confusion w/ the docs regarding the order of the code. I've really been meaning to write a blog post on how we use knockout + webpack/browserify for modular Knockout SPA goodness. |
Unfortunately it doesn't work. (function(){
'use strict';
ko.components.register('FirstComponent', {
template: '<h1 data-bind="text: tmplName"></h2>',
viewModel: function(ctx){
this.tmplName = 'First template';
console.dir(ctx);
}
});
ko.components.register('SecondComponent', {
template: '<h1 data-bind="text: tmplName"></h2>',
viewModel: function(ctx){
this.tmplName = 'Second template';
console.dir(ctx);
}
});
ko.router.route('/first', 'FirstComponent');
ko.router.route('/second', 'SecondComponent');
ko.router.start();
})(); Can you, please, provide a working example? |
add ko.applyBindings(); after ko.router.start(); |
please see the example site and docs for the newly published v3 and re-open if necessary |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello. Can you, please, guide me how to instantiate a router.
Here is very simple example of my playground:
index.html
app.js
I have a local server with "ko-router.dev" URI.
Well it does nothing actually.
Thanx in advance for help.
BTW: I think you have a mistake in basic usage docs -> 'Hello' vs 'Home'
The text was updated successfully, but these errors were encountered: