对象未定义Angular2,TypeScript

时间:2017-04-12 09:34:54

标签: angular typescript

当我尝试检查我传递的console.log(details)数据时,它说:

CompanyFullName:"asf"
CompanyName:"asf"
IsNewUser:true
LanguageCulture:"asf"
Serviceurl:"asf"
User:Object
Email:undefined
FirstName:undefined
LastName:undefined
Password:undefined
UserName:undefined

以下代码:

        export class SignupPage {

      serviceUrl: string;
      companyName: string;
      companyFullName: string;
      languageCulture: string;
      isNewUser: boolean;
      userName: string;
      firstName: string;
      lastName: string;
      email: string;
      password: string;
      loading: any;

      constructor(public navCtrl: NavController) {
        this.isNewUser = true;
      }
      register() {

        let details = {
          Serviceurl: this.serviceUrl,
          CompanyName: this.companyName,
          CompanyFullName: this.companyFullName,
          LanguageCulture: this.languageCulture,
          IsNewUser: this.isNewUser,
          User: {
            UserName: this.userName,
            FirstName: this.firstName,
            LastName: this.lastName,
            Email: this.email,
            Password: this.password
          }
        }
        console.log(details);
     }

0 个答案:

没有答案