欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

AngularJS中update兩次出現(xiàn)$promise屬性無(wú)法識(shí)別的解決方法

 更新時(shí)間:2017年01月05日 11:37:41   作者:TZQ_DO_Dreamer  
最近在工作中用AngularJS中update了兩次之后發(fā)現(xiàn)$promise屬性無(wú)法識(shí)別了,后來(lái)通過(guò)查找相關(guān)的資料終于解決了,想著記錄下方便自己或者有需要的朋友,所以本文主要介紹了AngularJS中update兩次出現(xiàn)了$promise屬性無(wú)法識(shí)別的解決方法,需要的朋友可以參考借鑒。

前言

本文主要介紹的是在AngularJS中update兩次出現(xiàn)$promise屬性無(wú)法識(shí)別的解決方法,下面話不多說(shuō),先來(lái)看看錯(cuò)誤提示,然后再看看解決的辦法吧。

一、錯(cuò)誤信息如下:

ERROR 2015-12-02 14:33:17,653 http-bio-8080-exec-42 o.s.s.r.i.e.InternalErrorExceptionMapper - Unrecognized field "$promise" (class com.inetpsa.fnd.rest.client.ClientRepresentation), not marked as ignorable (6 known properties: "lastName", "address", "telephone", "clientId", "mail", "firstName"]) 
 at [Source: org.apache.catalina.connector.CoyoteInputStream@1b9d797d; line: 1, column: 357] (through reference chain: com.inetpsa.fnd.rest.client.ClientRepresentation["$promise"]) 
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "$promise" (class com.inetpsa.fnd.rest.client.ClientRepresentation), not marked as ignorable (6 known properties: "lastName", "address", "telephone", "clientId", "mail", "firstName"]) 
 at [Source: org.apache.catalina.connector.CoyoteInputStream@1b9d797d; line: 1, column: 357] (through reference chain: com.inetpsa.fnd.rest.client.ClientRepresentation["$promise"]) 
 at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51) ~[jackson-databind-2.4.4.jar:2.4.4] 
 at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:744) ~[jackson-databind-2.4.4.jar:2.4.4] 
 at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915) ~[jackson-databind-2.4.4.jar:2.4.4] 
 at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1306) ~[jackson-databind-2.4.4.jar:2.4.4] 
 at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1284) ~[jackson-databind-2.4.4.jar:2.4.4] 
 at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:243) ~[jackson-databind-2.4.4.jar:2.4.4] 
 at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118) ~[jackson-databind-2.4.4.jar:2.4.4] 

二、問(wèn)題代碼

Angular 自動(dòng)會(huì)在返回的data數(shù)據(jù)中帶上$promise屬性。

在進(jìn)行下面copy時(shí)將從data返回的數(shù)據(jù)copy到當(dāng)前行用來(lái)顯示,這樣在進(jìn)行update的操作時(shí)帶的數(shù)據(jù)體中就包含了$promise屬性,結(jié)果就會(huì)出現(xiàn)上述錯(cuò)誤導(dǎo)致update失敗。  

三、更改如下:

// ===============show the update modal dialog ================== 
 $scope.tempRowEntityForUpdate; 
 $scope.openUpdateClientPopup=function(){ 
 $scope.form1.$setSubmitted(true); 
 $scope.tempRowEntityForUpdate = {}; 
 angular.copy($scope.currentSelectedRowEntity, $scope.tempRowEntityForUpdate); 
 angular.element('#UpdateDialog').modal({ 
 backdrop: false 
 }); 
 
 }; 
 
 $scope.updateClient=function(){ 
 if($scope.form1.$submitted && $scope.form1.$valid){ 
 Client.update({},$scope.tempRowEntityForUpdate,function(){ 
  angular.copy($scope.tempRowEntityForUpdate,$scope.currentSelectedRowEntity); 
 }); 
 
 angular.element('#UpdateDialog').modal('hide'); 
 } 
 }; 

解決辦法:不使用更新后獲得的data數(shù)據(jù),而是從當(dāng)前的行模型中取得數(shù)據(jù)copy給當(dāng)前選中的行即可。

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來(lái)一定的幫助,如果有疑問(wèn)大家可以留言交流。

相關(guān)文章

  • ng-alain的sf如何自定義部件的流程

    ng-alain的sf如何自定義部件的流程

    這篇文章主要介紹了ng-alain的sf如何自定義部件,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-06-06
  • AngularJS入門(mén)教程之AngularJS表達(dá)式

    AngularJS入門(mén)教程之AngularJS表達(dá)式

    AngularJS應(yīng)用表達(dá)式是純javascript表達(dá)式,并輸出它們被使用的數(shù)據(jù)在那里。本文給大家介紹AngularJS入門(mén)教程之AngularJS表達(dá)式,對(duì)angularjs表達(dá)式相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧
    2016-04-04
  • Angular2使用Augury來(lái)調(diào)試Angular2程序

    Angular2使用Augury來(lái)調(diào)試Angular2程序

    這篇文章主要介紹了Angular2使用Augury來(lái)調(diào)試Angular2程序,非常具有實(shí)用價(jià)值,需要的朋友可以參考下
    2017-05-05
  • AngularJS基礎(chǔ)知識(shí)筆記之表格

    AngularJS基礎(chǔ)知識(shí)筆記之表格

    這篇文章主要介紹了AngularJS基礎(chǔ)知識(shí)筆記之表格的相關(guān)資料,需要的朋友可以參考下
    2015-05-05
  • angular 基于ng-messages的表單驗(yàn)證實(shí)例

    angular 基于ng-messages的表單驗(yàn)證實(shí)例

    本篇文章主要介紹了angular 基于ng-messages的表單驗(yàn)證實(shí)例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-05-05
  • angular4中關(guān)于表單的校驗(yàn)示例

    angular4中關(guān)于表單的校驗(yàn)示例

    本篇文章主要介紹了angular4中關(guān)于表單的校驗(yàn)示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-10-10
  • angular報(bào)錯(cuò)can't resolve all parameters for []的解決

    angular報(bào)錯(cuò)can't resolve all parameters&nb

    這篇文章主要介紹了angular報(bào)錯(cuò)can't resolve all parameters for []的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • Angular表單驗(yàn)證實(shí)例詳解

    Angular表單驗(yàn)證實(shí)例詳解

    這篇文章主要介紹了angular表單驗(yàn)證的相關(guān)知識(shí),angular來(lái)驗(yàn)證可以定義樣式的,下文通過(guò)代碼給大家實(shí)例介紹下,需要的朋友可以參考下
    2016-10-10
  • 詳解Angular組件之生命周期(二)

    詳解Angular組件之生命周期(二)

    Angular本身監(jiān)督所有Angular組件和指令的生命周期 。為了在開(kāi)發(fā)應(yīng)用程序時(shí)順利進(jìn)行,您必須了解結(jié)果的生命周期。組件是任何Angular應(yīng)用程序的主要構(gòu)建塊。因此,必須了解它們才能理解組件生命周期的處理步驟。只有這樣才能在應(yīng)用程序的開(kāi)發(fā)中實(shí)現(xiàn)。
    2021-05-05
  • AngularJs 動(dòng)態(tài)加載模塊和依賴

    AngularJs 動(dòng)態(tài)加載模塊和依賴

    這篇文章主要介紹了AngularJs 動(dòng)態(tài)加載模塊和依賴方法的相關(guān)資料,需要的朋友可以參考下
    2016-09-09

最新評(píng)論