我未能让 Angular 2 反应式表单工作,其中FormGroup 嵌套在FormArray 中。有人可以告诉我我的设置有什么问题吗?
为简洁起见,省略了代码中不相关的部分。
以下是我的组件
orderForm: FormGroup = this.fb.group({
id: [''],
store: ['', Validators.required],
//The part related to the error
order_lines: this.fb.array([
this.fb.group({
id: [''],
order_id: [],
product_id: [],
description: ['', Validators.required],
unit_price: ['', Validators.required],
discount: [0],
units: [1, Validators.required],
line_total: ['', Validators.required]
})
])
});
constructor(private fb: FormBuilder) { }
//Order instance is passed from elsewhere in the code
select(order: Order): void {
this.orderForm.reset(order)
}
Run Code Online (Sandbox Code Playgroud)
Order传递给select方法的实例是这样的:
{
"id": 20,
"store": "Some Store", …Run Code Online (Sandbox Code Playgroud) 我是新的。到 NgRx。
当我尝试使用创建减速器createReducer()时出现错误Expected 4 arguments, but got 2.
当我尝试将第 3 和第 4 个参数作为空值传递时,出现错误
Argument of type '(state: any, { updatedValue }: any) => any' is not assignable to parameter of type 'readonly ActionCreator<string, FunctionWithParametersType<any[], object>>[]'.
Type '(state: any, { updatedValue }: any) => any' is missing the following properties from type 'readonly ActionCreator<string, FunctionWithParametersType<any[], object>>[]': concat, join, slice, indexOf, and 15 more.ts(2345)
Run Code Online (Sandbox Code Playgroud)
减速机代码
import { createReducer, on, State, Action } from '@ngrx/store';
import { Ingredient } from …Run Code Online (Sandbox Code Playgroud) 我正在启动一个应用程序,我的要求很少。
我在 flutter 中检查了位置和地理定位包,但无法决定我应该使用哪一个。如果有人可以帮助我区分它们,那将非常有帮助。
谢谢。
我在我的 flutter 应用程序中使用 firebase。在我的应用程序中,用户可以使用 3 种方式登录或注册。
现在我的疑问是如何为具有相同电子邮件 ID 的用户链接多个身份验证提供商?
我使用 Uid 将用户信息存储到用户集合中。如果我为多个提供商启用多个帐户,如何将用户数据存储在同一个文档中?
我在谷歌上搜索了很多,但没有找到合适的解决方案。
对于使用电子邮件 ID 进行注册,我使用的是这个。
final newUser = await _auth.createUserWithEmailAndPassword(
email: widget.email, password: widget.pass);
Run Code Online (Sandbox Code Playgroud)
然后我将用户的数据存储到用户集合中。(在这个表格中,我还有一种表格,我可以从其中获取其他数据)。
谷歌登录代码
Future<User> signInWithGoogle() async {
// Trigger the authentication flow
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
// Obtain the auth details from the request
final GoogleSignInAuthentication googleAuth = await googleUser.authentication;
// Create a new credential
final GoogleAuthCredential credential = GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
); …Run Code Online (Sandbox Code Playgroud) 我的文件位于app/design/frontent/vendor_name/theme/Magento_Theme/templates/html/test.phtml
如何在另一个phtml文件,xml布局,静态块和cms页面中调用此文件
请帮忙
我想导入我在应用程序中创建的模块,以将其加载到具有其自身路由的特定路由上
我有一些这样的链接
<li routerLinkActive="active" class="nav-item">
<a [routerLink]="['contracts']"
[queryParams]="{ activeOnly: false }"
class="nav-link">Contracts</a>
</li>
Run Code Online (Sandbox Code Playgroud)
你在参数中看到我有?activeOnly=false,当我的网址像这样时,使用这种方法一切都可以
Contracts?activeOnly=false 在 html 中添加活动 css 类,用户可以看到它是活动链接
我遇到的问题是,有时 url 可以像这样的 contracts?activeOnly=true&id=1一样更改,然后active css 不再适用。
我需要的是在元素上有活动的 css 类,即使 url 已随查询参数更改。
示例如果 url 是这样的contracts?activeOnly=true&id=1
活动CSS 类也必须保留在LI html 标签上
我试图在选项卡(角度材料)内显示图表 js 折线图,但图表未显示,它显示为空。
这是我的代码:
HTML:
<mat-tab-group animationDuration="0ms">
<mat-tab label="First">
<div class="chart-container" style="height:50vh;">
<canvas id="demo"></canvas>
</div>
</mat-tab>
<mat-tab label="Second">Content 2</mat-tab>
<mat-tab label="Third">Content 3</mat-tab>
</mat-tab-group>
Run Code Online (Sandbox Code Playgroud)
js 文件:
var chartColors = {
test_1: '#fba66c',
test_2: '#86b9ce',
test_3: '#4274fd'
};
var canvas : any = document.getElementById("demo");
var ctx = canvas.getContext("2d");
var test_1_data = [1, 0, 3, 0, 5, 6, 8];
var test_2_data = [5, 1, 8, 0, 3, 6, 5];
var test_3_data = [9, 8, 3, 4, 5, 6, 2];
var lineChartData = { …Run Code Online (Sandbox Code Playgroud) angular ×5
javascript ×3
flutter ×2
charts ×1
dart ×1
firebase ×1
geolocation ×1
html ×1
location ×1
magento ×1
magento2 ×1
ngrx ×1
ngrx-store ×1