Cannot write a value to a ko.computed unless you specify a 'write' option

rahularyansharma

I am trying to use computed properties in another computed properties and when i run code i am getting following error in console.

Cannot write a value to a ko.computed unless you specify a 'write' option

function AppViewModel() {
    var self = this; 
    self.firstName = ko.observable('rahul');
    self.lastName = ko.observable('sharma');
    self.fullName = ko.computed(function() {
      return self.firstName() +' ' + self.lastName();
    });
    self.upperFullName = ko.computed(function() {
      return self.fullName.toUpperCase();
    });  
}
// Activates knockout.js
ko.applyBindings(new AppViewModel()); 

and here is html code and js fiddle link

<p><input data-bind="value: firstName"></p>

<p><input data-bind="value: lastName"></p>

<p><input data-bind="value: fullName"></p>

<p> <span data-bind="text: upperFullName"> </span> </p>
lordvlad

self.fullName is a function, returning the computed value.

self.upperFullName = ko.computed(function() {
  return self.fullName().toUpperCase();
});  

notice the parenthesis!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Write value based on number of rows

From Dev

Cannot write URLConnection because of doOutput

From Dev

Cannot write property IsFileStream

From Dev

Cannot get the value of write-only property 'runProguard' with Gradle plugin 0.14.0 and Android Studio 0.9.0

From Dev

Cannot write to file

From Dev

How to write an int value to a file?

From Dev

ko.Computed() is not updating with observableArray

From Dev

Accents in vim: Cannot write "â"

From Dev

Read/write value with pipe

From Dev

Android BLE: cannot write a Characteristic (no PROPERTY_WRITE)

From Dev

Response.write() not returning value

From Dev

ko computed not showing in view

From Dev

ko.computed field for data-value

From Dev

Cannot write to containerURLForSecurityApplicationGroupIdentifier?

From Dev

should you use fread/fwrite or read/write system calls when you want to specify the buffer size explicitly?

From Dev

Explicitly specify specify string to write to for std::ostringstream

From Dev

Cannot Write Web Crawler in Python

From Dev

Cannot write to memory mapped file

From Dev

Write value of class JQuery

From Dev

Cannot write chinese characters to a filename

From Dev

Write for logical value Matlab

From Dev

Corebluetooth write Hexadecimal Value for Characteristic

From Dev

How can you set a MongoDB write concern at database level that cannot be overridden?

From Dev

Knockout JS Error: Cannot write a value to a ko.computed unless you specify a 'write' option

From Dev

How would you write a "constructor"

From Dev

How can I force a writable computed observable to write with Javascript

From Dev

How do I write a SQL query filter with an unless?

From Dev

Write xml with a path and value

From Dev

Write computed setter as a public function

Related Related

  1. 1

    Write value based on number of rows

  2. 2

    Cannot write URLConnection because of doOutput

  3. 3

    Cannot write property IsFileStream

  4. 4

    Cannot get the value of write-only property 'runProguard' with Gradle plugin 0.14.0 and Android Studio 0.9.0

  5. 5

    Cannot write to file

  6. 6

    How to write an int value to a file?

  7. 7

    ko.Computed() is not updating with observableArray

  8. 8

    Accents in vim: Cannot write "â"

  9. 9

    Read/write value with pipe

  10. 10

    Android BLE: cannot write a Characteristic (no PROPERTY_WRITE)

  11. 11

    Response.write() not returning value

  12. 12

    ko computed not showing in view

  13. 13

    ko.computed field for data-value

  14. 14

    Cannot write to containerURLForSecurityApplicationGroupIdentifier?

  15. 15

    should you use fread/fwrite or read/write system calls when you want to specify the buffer size explicitly?

  16. 16

    Explicitly specify specify string to write to for std::ostringstream

  17. 17

    Cannot Write Web Crawler in Python

  18. 18

    Cannot write to memory mapped file

  19. 19

    Write value of class JQuery

  20. 20

    Cannot write chinese characters to a filename

  21. 21

    Write for logical value Matlab

  22. 22

    Corebluetooth write Hexadecimal Value for Characteristic

  23. 23

    How can you set a MongoDB write concern at database level that cannot be overridden?

  24. 24

    Knockout JS Error: Cannot write a value to a ko.computed unless you specify a 'write' option

  25. 25

    How would you write a "constructor"

  26. 26

    How can I force a writable computed observable to write with Javascript

  27. 27

    How do I write a SQL query filter with an unless?

  28. 28

    Write xml with a path and value

  29. 29

    Write computed setter as a public function

HotTag

Archive