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 Dev

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

From Dev

Error: Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters

From Dev

Knockout Computed - write a new value

From Dev

ko.computed field for data-value

From Dev

Write computed setter as a public function

From Dev

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

From Dev

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

From Dev

Change value of a input (write into the input) when a option is selected from a select

From Dev

Can't write to flash drive unless root

From Dev

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

From Dev

Is it specify to write a programme in predefined manner

From Dev

how do you write over one dynamic value

From Dev

Can you write SQL DELETE code the same as INSERTING a value?

From Dev

ko computed not showing in view

From Dev

Mifare 1K write block but cannot read value block

From Dev

WIX cannot write value to registry if key contains space

From Dev

Cannot write property IsFileStream

From Dev

Accents in vim: Cannot write "â"

From Dev

Cannot write to containerURLForSecurityApplicationGroupIdentifier?

From Dev

Cannot write to file

From Dev

PHP Cannot Write to Socket?

From Dev

Cannot write diacritics

From Dev

Debian sendmail Cannot write

From Dev

Cannot write property IsFileStream

From Dev

Cannot write accents in TextInput

From Dev

Cannot write data to struct

From Dev

Program cannot write files

From Dev

Do you need to specify the "defaults" option in fstab?

From Dev

Group member cannot write even with write permission

Related Related

  1. 1

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

  2. 2

    Error: Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters

  3. 3

    Knockout Computed - write a new value

  4. 4

    ko.computed field for data-value

  5. 5

    Write computed setter as a public function

  6. 6

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

  7. 7

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

  8. 8

    Change value of a input (write into the input) when a option is selected from a select

  9. 9

    Can't write to flash drive unless root

  10. 10

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

  11. 11

    Is it specify to write a programme in predefined manner

  12. 12

    how do you write over one dynamic value

  13. 13

    Can you write SQL DELETE code the same as INSERTING a value?

  14. 14

    ko computed not showing in view

  15. 15

    Mifare 1K write block but cannot read value block

  16. 16

    WIX cannot write value to registry if key contains space

  17. 17

    Cannot write property IsFileStream

  18. 18

    Accents in vim: Cannot write "â"

  19. 19

    Cannot write to containerURLForSecurityApplicationGroupIdentifier?

  20. 20

    Cannot write to file

  21. 21

    PHP Cannot Write to Socket?

  22. 22

    Cannot write diacritics

  23. 23

    Debian sendmail Cannot write

  24. 24

    Cannot write property IsFileStream

  25. 25

    Cannot write accents in TextInput

  26. 26

    Cannot write data to struct

  27. 27

    Program cannot write files

  28. 28

    Do you need to specify the "defaults" option in fstab?

  29. 29

    Group member cannot write even with write permission

HotTag

Archive