我正在角度2中创建一个反应形式,并使用材料角度2来输入;
我需要将输入设置为禁用,并在提交未锁定输入中的值时将要发送的值.我已经创建了输入并且禁用了正在运行.我的问题是,当我提交一个提交值时,它不会来.
我的代码
this.formVariacao = this._fb.group({
id:[p && p['id']],
codigoItem: [p && p['codigoItem'], Validators.required],
});
Run Code Online (Sandbox Code Playgroud)
我的HTML
<md-input-container>
<input mdInput placeholder="Código da Variação" formControlName="codigoItem" name="codigoItem">
</md-input-container>
Run Code Online (Sandbox Code Playgroud)
我按如下方式阻止输入
this.formVariacao.get('codigoItem').disable();
Run Code Online (Sandbox Code Playgroud)
只有当我发送表格时,价值才会到来.Alguémpode me ajudar?
我正在加载延迟加载的模块.我遇到的情况是我需要在另一个模块中使用一种形式的模块.
例如,有产品模块和品牌模块.两者都以延迟加载方式加载.但我希望用户能够在产品表单中注册品牌.但我的问题是两个模块都是懒散加载的.
我真的需要完全加载这两个模块吗?或者我可以只加载所需的组件?
我的加载延迟加载:
const productRoutes: Routes = [
{
path: 'product',
loadChildren: 'app/admin/product/product.module#ProductModule',
canLoad: [AuthGuard]
}
];
const brandRoutes: Routes = [
{
path: 'brand',
loadChildren: 'app/admin/brand/brand.module#BrandModule',
canLoad: [AuthGuard]
}
];
Run Code Online (Sandbox Code Playgroud)
我的组件:
....
<div class="form-group">
<label for="exemplo">Create Name Product</label>
<input type="text" name="name" [(ngModel)]="Product.name" #name="ngModel" >
</div>
<div class="form-group">
<label for="exemplo">Create Brand</label>
<brand-form-component></brand-form-component>
</div>
Run Code Online (Sandbox Code Playgroud)
编辑
我创建了共享模块:
import { NgModule } from '@angular/core';
import { FormComponent as
FormBrandComponent } from '../../brand/brand-form/form.component'
@NgModule({
imports: [ ],
declarations: [ FormBrandComponent ],
providers: [ …Run Code Online (Sandbox Code Playgroud) 抱歉,如果问题太基本。
我想知道是否应该避免在系统中进行双向数据绑定。我可以在提交表单时捕获表单的值,而无需使用两种方式的数据绑定。
我的问题是双向数据绑定是否实际上消耗了太多内存。我应该停止使用它吗?
我正在使用react native + redux + redux-thunk我对redux并没有太多的经验
我正在组件内部调用动作。
this.props.checkClient(cliente);
if(this.props.clienteIsValid){
...
}
Run Code Online (Sandbox Code Playgroud)
在该操作中,将调用一个需要花费几秒钟的api。
export const checkClient = (cliente) => {
return dispatch => {
axios.get(`${API_HOST}/api/checkclient`, header).then(response => {
dispatch({type: CHECK_CLIENT, payload: response.data }); //valid or invalid
}).catch((error) => { });
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何在api响应完成之前将动作的返回延迟?我需要api响应才能知道客户端有效还是无效。也就是说,我需要解决该操作,然后验证客户端有效或无效。
我有一个元素div与属性contenteditable ="true".这个div的行为类似于textarea元素.
<div v-on:keyup.enter="SendMensage" v-html="msg" contenteditable="true"></div>
Run Code Online (Sandbox Code Playgroud)
我的代码:
data() {
return {
msg: '',
}
},
methods: {
enviaMensagem() {
console.log(this.msg);
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是数据绑定不起作用.div中输入的内容不反映变量.有谁知道它能是什么?
angular ×3
lazy-loading ×1
react-native ×1
react-thunk ×1
reactjs ×1
redux ×1
vue.js ×1
vuejs2 ×1