使用状态参数发送数据时出现语法错误

时间:2017-12-19 08:04:46

标签: javascript angularjs angular-ui-router

我在页面中使用状态参数将数据从一个页面发送到另一个页面,这是我得到的错误:

Syntax Error: Token ':' is unexpected, expecting [}] at column 157 of the expression 

请看一下我在下面写的代码:

<a ui-sref="EditoldAddress({id:AddressGetData.id,fullName:AddressGetData.companyName,MobileNo:AddressGetData.phoneNo,AternateMob:AddressGetData.alternatePhoneNo,contct1:AddressGetData:contactPersonName,contact2:AddressGetData.secondContactPerson,add1:AddressGetData.addressLine1,add2:AddressGetData.addressLine2,pinCode:AddressGetData.pinCode,landMrk:AddressGetData.landMark,state:AddressGetData.state,serId:AddressGetData.userId,Place:AddressGetData.place})">Edit</a>

JS Part:

  .state('EditoldAddress', {
        url: '/EditoldAddress/:id/:fullName/:MobileNo/:AternateMob/:contct1/:contact2/:add1/:add2/:pinCode/:landMrk/:state/:UserId/:Place',
        templateUrl: 'Edit-old-address.html',
        controller: 'EditoldController'
    }) 

提前致谢:)

1 个答案:

答案 0 :(得分:0)

在美化了ui-sref值后,它看起来像是:

EditoldAddress({
  id: AddressGetData.id,
  fullName: AddressGetData.companyName,
  MobileNo: AddressGetData.phoneNo,
  AternateMob: AddressGetData.alternatePhoneNo,
  contct1: AddressGetData
  : contactPersonName,
  contact2: AddressGetData.secondContactPerson, 
  add1: AddressGetData.addressLine1, 
  add2: AddressGetData.addressLine2,
  pinCode: AddressGetData.pinCode, 
  landMrk: AddressGetData.landMark, 
  state: AddressGetData.state,
  serId: AddressGetData.userId,
  Place: AddressGetData.place
})

contactPersonName的部分已损坏。