javascript - Knockout unexpected identifier "." -


I am creating a new app with knockout and I am having a very strange error. I use the knockout for a while and never had this error before.

Every time I try to use "$ root". Pseudoselector returns to knockout:

  Unwanted syntax error: Unable to parse binding Binding value: Click: .createAlarm message: Unexpected token  

This case In, was compulsive:

  & lt; Button class = 'btn' data-bind = 'click: $ root.createAlarm' & gt; New alarm & lt; / Button & gt;  

The same thing happened when I tried to refer to a view model function inside a foreach binding.

Here is my code:

  View function mode () {var itself = this; Set the initial time for // data // alarm itself. Bell = helm (moment (hour) (hours); Self. Alarmminute = K. Horsele (moment (.) Minute ()); Self.alarmSecond = ko.observable (moment (.) Seconds ()); Self.chosenAlarmTrack = ko.observable (); Self.alarms = ko.observableArray (); // methods themselves .createAlarm = function () {var timeNow = moment () var alarmTime = getNewTime (self.alarmHour), self.alarmMinute (), self.alarmSecond ()); Var alarm time = moment (alarm time) if (tymoon isiater (alarmtime)) {alarmTime.add (1, "day"); } Self.alarms.push (new alarm (alarmtime, self choseen alarm track))}} $ (document) .ready (function () {var vm = new ViewModel (); ko.applyBindings (vm);})  

Since php templates require PHP variables as $ , you need to do this as $ its html code And for <36> equivalent to # 36. Instead of using

  $ parent $ root  

  & amp; ; # 36; Parents & amp; # 36; Route  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -