-3

I fetch data from a model in Angular service , and in console log the data become like this.

console.log(serces);

alModel {info: Object}
    info: Object
    ProductName:"test product al"
    StartTime:"00:00:00"
    StopTime:"00:00:00"
    __proto__:Object
__proto__:Object

How do I to get the ProductName from there?

Please help, many thanks in advance.

al_kasih_empatix
  • 127
  • 2
  • 11

1 Answers1

1

To access properties of an object, either use dot notation:

serces.ProductName

or bracket notation:

serces['ProductName']

Read away: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors

jmealy
  • 583
  • 1
  • 5
  • 14
  • Why the down vote? Please explain how this doesn't address the question. – jmealy Jul 10 '16 at 01:09
  • 1
    I didn't downvote, but encountered this while reviewing low quality answers. Code-only answers are considered low quality content on StackOverflow, so the downvote is almost certainly because there's no explanation about why this solves the problem that the OP asked about. Add an explanation and you'll be fine. Note that if you continue answering and get zero or negative votes, you may be automatically banned from answering. It's best to fix this and make sure that any other answers also have a suitable explanation. – Michael Gaskill Jul 10 '16 at 02:41
  • 1
    Thank you, @MichaelGaskill. I've fleshed out my answer further. – jmealy Jul 10 '16 at 02:46