我正在尝试实现自定义验证器来检查密码和密码确认是否相等.问题是验证器正在获取未定义的密码和确认的密码参数.我该如何做这项工作.该函数有效,如果我将条件更改为===而不是!==当字段相同时,它会正确抛出错误.有谁知道这里的错误是什么?
signup.component.html
<div class="col-md-7 col-md-offset-1 col-sm-7">
<div class="block">
<div class="well">
<form (onSubmit)="onSubmit()" [formGroup]="signUpForm">
<div class="form-group">
<label for="username" class="control-label">Nombre de usuario:</label>
<input type="text" class="form-control" formControlName="username" title="Please enter your username" placeholder="username">
<p class="help-block" *ngIf="signUpForm.get('username').hasError('required') && signUpForm.get('username').touched">El nombre de usuario es obligatorio</p>
<p class="help-block" *ngIf="signUpForm.get('username').hasError('minlength') && signUpForm.get('username').touched">El nombre de usuario debe tener al menos 6 caracteres</p>
<p class="help-block" *ngIf="signUpForm.get('username').hasError('maxlength') && signUpForm.get('username').touched">El nombre de usuario debe tener menos de 15 caracteres</p>
</div>
<div class="form-group">
<label for="email" class="control-label">E-mail:</label>
<input class="form-control" formControlName="email" title="Please enter your email" …Run Code Online (Sandbox Code Playgroud) javascript angular-validation angular angular-reactive-forms
我正常做一些用jest和酶进行单项测试的新项目.我以这种方式测试连接到redux的组件:
a)商店发电机
import { createStore } from 'redux';
import rootReducer from '../src/reducers';
export const storeFactory = (initialState) => {
return createStore(rootReducer, initialState);
}
Run Code Online (Sandbox Code Playgroud)
这是由Input.test.js文件使用的
import React from 'react';
import { shallow } from 'enzyme';
import { findByTestAttr,storeFactory } from '../../../test/testUtils';
import Input from './Input';
const setup = (initialState={}) => {
const store = storeFactory(initialState);
const wrapper = shallow(
<Input store={store} />
).dive();
console.log(wrapper.debug());
}
Run Code Online (Sandbox Code Playgroud)
作为示例组件Input.js:
import React, { Component } from 'react';
import { connect } from 'react-redux';
class Input …Run Code Online (Sandbox Code Playgroud) 我正在使用新语法来遵守RxJS 6 pipe()。同样使用Angular6。我有一个处理http请求的服务,它通过管道catchError传输地图并在出现连接错误时显示祝酒词。不过,如果我添加,catchError我会进入控制台,您在期望流的位置提供了“ undefined”。您可以提供一个Observable,Promise,Array或Iterable。
getDataHttpRequest(url, returnType) {
return this.http.get(url, this.getRequestOptions())
.pipe(
map((response) => {
if(response){
if (returnType === 'object') {
return response[0] == undefined ? response : response[0];
} else {
return response;
}
}
}),
catchError((error):any => {
if(error instanceof HttpErrorResponse && error.status === 0){
//no connection error(either user has no connection or the server is down)
this.toastr.error('Chequee su conexión e intente de nuevo en unos momentos. Contáctenos para reportar el problema a …Run Code Online (Sandbox Code Playgroud) 我的代码遇到了问题.我正在使用3个选项卡在ReactJS中构建一个单页Web应用程序.
当用户转到一个选项卡时,应显示FirebaseUI中的身份验证表单.问题是它只在第一次和第二次工作,如果我改为另一个选项卡并返回,它崩溃,React重新渲染使用身份验证表单呈现div的组件并抛出错误:
"firebase.js:26 Uncaught Error: Firebase App named '[DEFAULT]-firebaseui-temp' already exists."
Run Code Online (Sandbox Code Playgroud)
我的index.html是:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="./src/favicon.ico">
<script src="https://www.gstatic.com/firebasejs/3.4.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyAdyeoTYNF0xLK37Zv3nEGHWCKNPQjSPsI",
authDomain: "xxxx.com",
databaseURL: "xxxxx.com",
storageBucket: "xxxxxx.appspot.com",
messagingSenderId: "xxxxxx"
};
firebase.initializeApp(config);
</script>
<script src="https://www.gstatic.com/firebasejs/ui/live/0.5/firebase-ui-auth.js"></script>
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/live/0.5/firebase-ui-auth.css" />
<title>Flockin</title>
</head>
<body>
<div id="root" class="container"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, …Run Code Online (Sandbox Code Playgroud) javascript firebase reactjs firebase-authentication firebaseui
我使用Facebook提供程序使用Firebase-UI登录,我想知道如何从中获取令牌.我搜索到处都没有任何成功,只找到javascript响应而不是java.这是代码:
public class MainActivity extends AppCompatActivity {
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
private int[] tabIcons = {
R.drawable.ic_rrr,
R.drawable.compass,
R.drawable.bell,
R.drawable.cloud,
R.drawable.user_circle,
};
SharedPreferences preferences;
private Firebase myFirebaseRef = new Firebase("https://xxxxxxxxx/");
private FirebaseAuth auth;
private FirebaseUser firebaseUser;
private FirebaseAuth.AuthStateListener mAuthListener;
private User user;
private static final int RC_SIGN_IN = 100;
private static final int FLOCKIN_PROVIDER = 1;
private static final int FACEBOOK_PROVIDER = 2;
Geocoder geocoder;
String bestProvider;
double lat;
double lng;
List<Address> usr = null; …Run Code Online (Sandbox Code Playgroud) android facebook facebook-graph-api firebase firebase-authentication
angular ×2
firebase ×2
javascript ×2
reactjs ×2
android ×1
angular6 ×1
enzyme ×1
facebook ×1
firebaseui ×1
jestjs ×1
redux ×1
rxjs ×1
rxjs6 ×1
unit-testing ×1