angular.js - How to add new attributes to objects in angularjs (for example, I got an object o from the background, and I want to add a custom attribute name to o)
天蓬老师2017-05-15 16:56:32
0
3
835
How to add new attributes to objects in angularjs data is an array of objects obtained from the background. I want to add attributes to value The code is as follows:
You can introduce the lodash library and use the _.map method. I often use it in projects for various data operations, which is very convenient. I have to complain about the API provided by the backend staff and make it more friendly. Isn’t that good for everyone?
Use Array.prototype.forEach() directly
You can introduce the lodash library and use the _.map method. I often use it in projects for various data operations, which is very convenient. I have to complain about the API provided by the backend staff and make it more friendly. Isn’t that good for everyone?