Friday 15 February 2013

knockout.js - Knockout applyBindings Error -


I have SPA using Dorlands and Knock OutJesses. I allow a click on an item on my starting page And then load the secondary page for that item. In this way I use the secondary page:

  var goToDetails = function (selectedDailyLog) {var url = '# / dailylog /' + selectedDailyLog.id (); // durandal / plugins / router is the sammy.js router. NavigateTo (url); }; On the secondary page, I am trying to make a free call and I get the following error:  

Unfair error: Unable to parse binding. Message: ReferenceRere: Router is not defined; Binding Value: Forrest: Router VisibleRounds

Here is javascript for the secondary page:

  define (['config', 'durandal / system', 'services / logger' 'Service / data service'], function (config, system, logger, datasive) {var owners = CO.VerseWeblyRay (); var selected owner = to.OswaveWeb (); var daily log = to. (Start: 'one' }); Var MargCertrea; # # Region Internal Ways to Activate Function (Route Data) (RootCattery = Route Data; Data Services (Property) A) logger.log ('Daily log with active id:' + route data Id.toString (), blank, 'daily log', true);} true;} var vm = {active: active, title: 'Daily Log', Owners: Owners, Selected Opener: Selected Owners, Daily Logs: Daily Logs}; K.Polli Binings (Vm); Return vm;   

})

Thank you in advance for help.

There are some things that exits in the above example Leads in Durandal app The most important thing is that there is no reason to call ko.applyBindings (vm) because it is covered by Durandal Second, the active work return is correct, which is If there is permission for the dataset (owners) is a synchronous operation, then you have to make sure that you will return a promise instead.

Let's see what happens when ko.applybinding (vm) runs and generates an error message. When ko.applyBinding is running without the second parameter, it tries to bind vm against the whole dome. This conflict on the first event of a property which is not defined in vm, such as the default starter template is a navigation section in shell.html or nav.html Example

    

In the example, there is no router defined in VM, so the system generates errors

  var vm = {active: active, title: 'daily log' Owners, Owners, Selected Opener: Selected Owners, Daily Logs: Daily Logs}; // ko.applyBindings (vm); // Do not Call on Application To Force a Durandal App Return VM;   

But as above it has been said that by looking at the symptoms of just one call that should not have been in the first place. If you want to take a look at the samples or to learn more about Durandal's building principles.

No comments:

Post a Comment