-3

How to filter TimeSpan response with Angular.

This is what i get from server (JSON form of TimeSpan)

{"0":"\"","1":"0","2":"2","3":":","4":"0","5":"0","6":":","7":"0","8":"0","9":"\""}

The server call is

public TimeSpan GetCurrentWorkhourState(int employeeId, DateTimeOffset date)

Why does it send like json??

sparrkli
  • 661
  • 1
  • 7
  • 17
  • It would really help if you'd give some more context here. In particular, that looks like it should really just be a string response... please show your C# code. – Jon Skeet Aug 01 '14 at 09:24
  • On server side i am doing some calculations with time, and on client side i just need to show it. My server response is timespan, and this is what i get on client side, so i don't understand how to format this – sparrkli Aug 01 '14 at 09:28
  • Rather than describe it, please show the code on the C# side - it doesn't even need to be your *actual* code, so long as it's code which would give the same result (which you should check) - a method that always returns the same TimeSpan would be fine. – Jon Skeet Aug 01 '14 at 09:34
  • Not allowed to show code, but in Debug.Write (result), it shows 02:00:00 – sparrkli Aug 01 '14 at 09:39
  • I'm sure you *are* allowed to show sample code that shows what your method declaration looks like - again, I'm not asking you to post the actual code, but *representative* code. If you can't even post the method declaration and describe what you're using (Web API?) then we're unlikely to be able to help you. – Jon Skeet Aug 01 '14 at 09:40
  • public TimeSpan GetCurrentWorkhourState(int employeeId, DateTimeOffset date), is that what you mean? no use in showing code cause it just calls lot of other methods. – sparrkli Aug 01 '14 at 09:43
  • 1
    Yes, that's the one I mean - but put it in the question, with any attributes applied to it, along with details of what frameworks you're using. Currently you've given us *way* too little context. – Jon Skeet Aug 01 '14 at 09:52

1 Answers1

0

The problem was that i was using $resource which works only with objects and arrays, and not with raw strings

sparrkli
  • 661
  • 1
  • 7
  • 17