javascript - How to replace ' / ' with '-' inside ObservableArray ? Knockout js -
Well, I'm trying to pass an observable array to my controller via AJAX call, But I get every value other than the date I get something like '01 -01-01 '.
I found this problem but unable to fix it because I do not know how to replace There are about 10 list items in my observable array, in each list item There are many properties outside The thought of posting my function and I hope that in this case I am not required. I have been explained with a little code and sample data: MyObservableArray: In between I do something to load data in The possibility I am trying to change myself as I want to. Changing the main () and start-up and using the self to send the same controller. >> Possible Solution: I can use a different undisclosed array and push all the VM's If someone can show some light then it is highly appreciated. What do I get you to face the problem of avoiding Try it / with
- .
startdate , such as
("23/10/2014") just
("23-10-2014") Need something like that.
function myarray () {var self = this; Self.startDate = ko.observable (""); Self.name = ko.observable (""); Self.place = ko.observable (""); }
self.Main = ko.observableArray ();
self.main and I'm sending myself. The controller has the controller with the following types of data:
The main [0] holds: startDate () - & gt; You may see the name () -> & gt; Array based on "23/10/2014" / "Zone" location () - & gt; "Croatia"
self The main [9] holds: startDate () - & gt; "29/05/2012" name () - & gt; "Pop" location () - & gt; "USA"
main but I can do it on
self.main Trying to use without me.
/ Used to be.
"(23/10/2014)". Var arr = [{Date: "(23/10/2014)"}, {date: "(23/10/2014)"}, {Date: "(23/10/2014)"}, {Date: "(23/10/2014)"}]; Arr.forEach (function (obje) {obj.date = obj.date.replace (/ \ g / "," - ")}) Console.log (arr) // Date field for all items" (23 -10-2014) "will print as
Comments
Post a Comment