Guest User

Untitled

a guest
Jan 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. function ChildCollectionViewModel() {
  2. var self = this;
  3.  
  4. self.CollectionElements = ko.observableArray([]);
  5.  
  6. // data-bound to a button that adds a new element
  7. self.addCollectionElement = function () {
  8. self.CollectionElements.push(new CollectionElement());
  9. };
  10.  
  11. // data-bound to a button that removes the current element
  12. self.removeCollectionElement = function (collectionElement) {
  13. self.CollectionElements.destroy(collectionElement);
  14. };
  15.  
  16. function CollectionElement() {
  17. var self = this;
  18.  
  19. self.Id = ko.observable();
  20. self.Prop1 = ko.observable();
  21. self.Prop2 = ko.observable();
  22. self.Prop3 = ko.observable();
  23. }}
Add Comment
Please, Sign In to add comment