Javascript / Angular - JS Object的属性和方法

时间:2017-06-26 18:38:53

标签: javascript angular service controller factory

JavaScript对象是名为属性或方法的命名值的容器,但我想知道当我将一些对象发送到Angular的$ http.post时,它是否只识别属性?

参考:https://www.w3schools.com/js/js_objects.asp 我的意思是:

// TestFactory中

SELECT rank, performance, wind,name,surname,dob,prov,pos,place,date FROM
(SELECT performance, wind,name,surname,dob,prov,pos,place,date,
@curRank := IF(@prevRank = performance, @curRank, @incRank) AS rank, 
@incRank := @incRank + 1, 
@prevRank := performance
FROM Men p, (
SELECT @curRank :=0, @prevRank := NULL, @incRank := 1
) r 
WHERE year='2017' AND event='100m' 
ORDER BY performance) s

//的TestController

return function(){
        {name: 'test1', getName :  function(){ return this.name }
       };

// TestService的

vm.Test = new TestFactory();
TestService.Save(vm.Test);

1 个答案:

答案 0 :(得分:0)

要查看有效负载的内容,您可以

console.log( JSON.stringify( test_data ) );

你会看到类似的东西

{
  'name': 'test1',
  'getName': '[Function]'
}