Questions tagged «reactive»


11
如何找到角度4反应形式的无效控件
我在Angular中有一个反应形式,如下所示: this.AddCustomerForm = this.formBuilder.group({ Firstname: ['', Validators.required], Lastname: ['', Validators.required], Email: ['', Validators.required, Validators.pattern(this.EMAIL_REGEX)], Picture: [''], Username: ['', Validators.required], Password: ['', Validators.required], Address: ['', Validators.required], Postcode: ['', Validators.required], City: ['', Validators.required], Country: ['', Validators.required] }); createCustomer(currentCustomer: Customer) { if (!this.AddCustomerForm.valid) { //some app logic } } this.AddCustomerForm.valid返回false,但是一切看起来不错。 我试图通过检查控件集合中的status属性来查找。但是我想知道是否有一种方法可以找到无效的并显示给用户?

4
等同于在Swift Combine中使用@Published的计算属性?
在命令式Swift中,通常使用计算属性在不复制状态的情况下提供对数据的便捷访问。 假设我将此类用于命令式MVC: class ImperativeUserManager { private(set) var currentUser: User? { didSet { if oldValue != currentUser { NotificationCenter.default.post(name: NSNotification.Name("userStateDidChange"), object: nil) // Observers that receive this notification might then check either currentUser or userIsLoggedIn for the latest state } } } var userIsLoggedIn: Bool { currentUser != nil } // …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.