File

src/modules/lesson/detail/edit/edit.component.ts

Metadata

selector app-edit
styleUrls edit.component.scss
templateUrl edit.component.html

Constructor

constructor(dataService: DataServiceService)

Methods

upload
upload()
Returns: void
saveFormData
saveFormData()
Returns: void

Properties

formData
formData: { name: string; weight: string; height: string; gender: string; }
import { Component } from '@angular/core';
import { DataServiceService } from '../data-service.service';
import * as Parse from "parse"
(Parse as any).serverURL = "http://metapunk.cn:9999/parse"
Parse.initialize("dev")

@Component({
  selector: 'app-edit',
  templateUrl: './edit.component.html',
  styleUrls: ['./edit.component.scss']
})
export class EditComponent {
  async upload() {
    let YourClass = Parse.Object.extend("Profile");
    let yourObject = new YourClass();

    yourObject.set({ "name": this.formData.name, "weight": this.formData.weight, "height": this.formData.height, "gender": this.formData.gender });
    yourObject.save().then((result: any) => {
      console.log("数据上传成功", result);
    }).catch((error: any) => {
      console.error("数据上传失败", error);
    });
  }

  formData = {
    name: '',
    weight: '',
    height: '',
    gender: ''
  };

  constructor(private dataService: DataServiceService) { }

  saveFormData() {
    localStorage.setItem('formData', JSON.stringify(this.formData));
  }

}

results matching ""

    No results matching ""