1
간단한 질문.Aurelia - 내 템플릿의 변수에 액세스 할 수 없습니다.
<template>
<section>
<h2>${heading}</h2>
<form role="form" submit.delegate="login()">
<div class="form-group">
<label for="userName">User Name</label>
<input type="text" value.bind="userName" class="form-control" id="userName" placeholder="User Name">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" value.bind="password" class="form-control" id="password" placeholder="Password">
</div>
<button type="button" click.delegate="submitLogin()" class="btn btn-default">Login</button>
</form>
<hr>
<div class="alert alert-danger" if.bind="loginError">${loginError}</div>
</section>
내가 내 login.ts 파일에 이러한 변수를 액세스 할 수있는 방법을 찾기 위해 주위를 둘러 보았다했습니다 : 사용자 이름과 암호 형태 -
나는 로그인 템플릿을 가지고있다.
특히 단추 로그인을 누르면 API에 보낼 수 있습니다.
submitLogin() 함수가 있지만 변수 사용자 이름과 비밀번호에 액세스하는 방법을 모르겠습니다.
누군가이 변수에 어떻게 액세스하는지 표시 할 수 있습니까? 나는 사용자 이름과 암호를 빨간색 밑줄을받을
..
import { HttpClient } from "aurelia-fetch-client";
import { autoinject } from "aurelia-framework";
import { TokenService } from "../tokenService";
@autoinject
export class Login {
http: HttpClient;
tokenService: TokenService;
heading = "Login";
constructor(tokenService: TokenService, http: HttpClient,) {
this.tokenService = tokenService;
this.http = http;
}
public submitLogin(): void {
console.log("userName, Password", this. userName, this.password);
}
}
엑셀 사순절. 이것은 정말로 간결한 대답이었습니다. 고맙습니다 – si2030