您如何将 redux 表单中复选框的默认布尔值更改为您在输入本身上指定的值?
例如,我有一个这样的输入:
<input type="checkbox" value="Pages missing or out of order" {...issue1} />
当 Redux 表单选择它时,它只会给我一个真/假,即使我想要值“页面丢失或乱序”
我可以做这样的事情来到达我需要去的地方,以便在表单提交时,它会提交值“页面丢失或乱序,而不是真/假?
<input type="checkbox" onChange={value => console.log(value.target.value)} value="Pages missing or out of order" />
当我删除 {...issue1} 时,将调用我的自定义 onChange 事件处理程序,但是当我保留 {...issue1} 时,它会被完全忽略。
想法?
所以我一直在使用这篇文章通过Angular CLI将Dropzone.js导入到我的Angular 2项目中.虽然这篇文章是在2个月之前发布的,但是我注意到这个人并没有在@NgModule中使用新的Angular CLI语法.
有没有办法可以将这个Dropzone.js npm模块导入到我的项目中?
我已经设法将Dropzone.js文件包含在angular-cli.json中的"scripts"属性中:
"scripts": [
"../node_modules/dropzone/dist/dropzone.js"
],
Run Code Online (Sandbox Code Playgroud)
这是我的dropzone组件:
import {
Component,
OnInit,
Input,
Output,
EventEmitter,
ElementRef
} from '@angular/core';
import {
Http
} from '@angular/http';
@Component({
selector: 'dropzone',
templateUrl: './dropzone.component.html',
styleUrls: ['./dropzone.component.scss']
})
export class DropzoneComponent implements OnInit {
private _dropzone: Dropzone;
@Input()
element: string = ".dropzoneArea";
@Input()
url: string = "file/post";
@Input()
uploadMultiple: boolean = false;
@Input()
maxFileSize: number = 2048;
@Input()
clickable: string = ".dropzoneArea";
@Input()
autoProcessQueue: boolean = true; …Run Code Online (Sandbox Code Playgroud) 我有一个关于处理Firebase中多对多关系的问题.基本上,我正在尝试从Firebase数据中的多个路径构建用户配置文件对象.我已经尝试构建一个返回observable的函数,然后更新该observable中的数据,因为嵌套的observable从Firebase获取数据.
问题是嵌套的observable永远不会被调用,从我所知道的.几个小时以来,我一直在打我的头,没有任何真正的成功.谁能说出我做错了什么?我觉得这是一个很常见的问题,可以解决.
public getUserProfile(data) {
return this._af.database.object(`/social/users/${data.id}`).map((user) => {
for ( let vidKey in user.videos) {
// Once the code hits this line, it never fires at all :(
this._af.database.object(`/social/videos/${vidKey}`).map((video) => {
user.videos[vidKey] = video;
});
}
return user;
});
}
Run Code Online (Sandbox Code Playgroud) firebase firebase-realtime-database ionic2 angularfire2 angular
我的应用程序中有一些聊天功能,当输入新消息时,它会自动滚动到底部<ion-content>,但是,就像许多聊天应用程序一样,如果您在聊天中向上滚动以阅读最新消息之前的内容,我不想滚动.只有当用户位于屏幕的最底部时,我才会在新消息进入后滚动到底部.我还没有解决这个问题.
这是我目前的代码:
scrollToBottom() {
// If the scrollTop is greater than the height, we are at the bottom,
// in which case, show scrolling animation
let dimensions = this.content.getContentDimensions();
let scrollHeight = dimensions.scrollHeight;
let scrollTop = dimensions.scrollTop;
let contentHeight = dimensions.contentHeight;
let heightAndScrollTop = contentHeight + scrollTop;
// This is the best I can get, assuming that the screen is in a consistent dimension, which we all know is basically non-existent due to all the different types of …Run Code Online (Sandbox Code Playgroud) 因此,我正在使用Angular 6使用AngularFire2构建Web应用程序,并且在加载应用程序时出现以下错误:
auth.js:255 Uncaught ReferenceError: global is not defined
at Object../node_modules/firebase/auth.js (auth.js:255)
at __webpack_require__ (bootstrap:81)
at Object../node_modules/firebase/firebase-browser.js (firebase-browser.js:11)
at __webpack_require__ (bootstrap:81)
at Object../src/app/core/auth.service.ts (auth.guard.ts:18)
at __webpack_require__ (bootstrap:81)
at Object../src/app/app.component.ts (main.js:156)
at __webpack_require__ (bootstrap:81)
at Object../src/app/app.module.ts (app.component.ts:9)
at __webpack_require__ (bootstrap:81)
./node_modules/firebase/auth.js @ auth.js:255
__webpack_require__ @ bootstrap:81
./node_modules/firebase/firebase-browser.js @ firebase-browser.js:11
__webpack_require__ @ bootstrap:81
./src/app/core/auth.service.ts @ auth.guard.ts:18
__webpack_require__ @ bootstrap:81
./src/app/app.component.ts @ main.js:156
__webpack_require__ @ bootstrap:81
./src/app/app.module.ts @ app.component.ts:9
__webpack_require__ @ bootstrap:81
./src/main.ts @ environment.ts:15
__webpack_require__ @ bootstrap:81
0 @ main.ts:14
__webpack_require__ @ …Run Code Online (Sandbox Code Playgroud) angular ×3
angularfire2 ×2
firebase ×2
ionic2 ×2
angular-cli ×1
angular6 ×1
dropzone.js ×1
reactjs ×1
redux ×1
redux-form ×1