尝试从基于模式的表单中调用登录功能
登录Component.html
<div class="modal-footer">
<button
(click)="userLogin(emailSignin.value, passwordSignin.value)"
class="btn loginBtn"
[disabled]="signin.invalid">
Submit <fa name="sign-in"></fa>
</button>
</div>
登录Component.ts
public userLogin(email, password) {
console.log(email);
const signIn = new SigninComponent();
this.userInfo = signIn.userSignIn(email, password);
}
这是完整的Component.ts 我已经导入了另一个处理登录HTTP请求的组件
import { SigninComponent } from '../signin/signin';
@Component({
selector: 'app-filter-search',
templateUrl: './filter-search.component.html',
styleUrls: ['./filter-search.component.css']
})
export class FilterSearchComponent implements OnInit {
userLogin(email: string, password: string) {
console.log(email);
const signIn = new SigninComponent();
this.userInfo = signIn.userSignIn(email, password);
}
}