小编Adi*_*ari的帖子

从对话框 mdl angular 2 获取多个数据

我正在尝试从 angular 2 的对话框中获取数据,但它显示了未定义的值。

dialog.component.ts

    import { Component } from '@angular/core';
    import { MdDialog, MdDialogRef } from '@angular/material';
    import { DialogResultComponent } from '../dialog-result/dialog-result.component';

    @Component({
      selector: 'app-dialog',
      templateUrl: './dialog.component.html'
    })
    export class DialogComponent {
      NewAge: string;
      newName: string;

      constructor(public dialog: MdDialog) {}
      ngOnInit() {
        //Called after the constructor, initializing input properties, and the first call to ngOnChanges.
        //Add 'implements OnInit' to the class.
         const dialogRef = this.dialog.open(DialogResultComponent);
        dialogRef.afterClosed().subscribe(result => {

          // how to retrieve multiple data?
          this.NewAge = result.age;
          this.newName …
Run Code Online (Sandbox Code Playgroud)

dialog angular

2
推荐指数
1
解决办法
2054
查看次数

验证器最小和最大数量 angular 4

是否有任何选项可以使验证器最小和最大数量,即 0 到 200 之间的数量?

dialog-result-component.ts

import { Component, OnInit } from '@angular/core';
import { MdDialog, MdDialogRef } from '@angular/material';
import { FormGroup,FormControl,Validators,FormBuilder,  } from '@angular/forms';



@Component({
  selector: 'app-dialog-result',
  templateUrl: './dialog-result.component.html',
})

export class DialogResultComponent {


  form: FormGroup;
  name = new FormControl('',Validators.required);
  width = new FormControl('',Validators.required);
  height = new FormControl('',Validators.required);
  constructor(public dialogRef: MdDialogRef<DialogResultComponent>,private fb: FormBuilder) {

  }

  ngOnInit() {
  this.form = this.fb.group({
      'name':    this.name,
      'width':   this.width,
      'height':  this.height,
    });
}

  saveData(){
    this.dialogRef.close({name:this.name,width:this.width,height:this.height});
  }
}
Run Code Online (Sandbox Code Playgroud)

对话框result.component.html

       <form [formGroup]="form">
     <h3>MineSweeperwix</h3>
      <div class="mdl-dialog__content"> …
Run Code Online (Sandbox Code Playgroud)

forms validation angular

2
推荐指数
2
解决办法
1万
查看次数

未为 -lBranch-SDK 找到反应本机 xcode 库

我已经反应了原生 v0.49。使用此链接链接安装 react-native-branch 到 react-native-branch 后,我尝试使用 xcode 运行,但出现错误

ld: library not found for -lBranch-SDK
Run Code Online (Sandbox Code Playgroud)

另外,当我运行 react-native-link 我得到

react-native-branch ERR! Failed to add file to project
Run Code Online (Sandbox Code Playgroud)

xcode ios react-native

1
推荐指数
1
解决办法
5745
查看次数

http post请求firebase云功能

我想在 firebase 云功能中发出发布请求并将数据发送到正文中。默认情况下,它是获取请求还是发布请求?

 var functions = require('firebase-functions');

exports.tryfunction= functions.https.onRequest((req, res) => {
    console.log(req.body) // or it should be req.query 
});
Run Code Online (Sandbox Code Playgroud)

我怎么知道并决定它是什么方法?

post http firebase google-cloud-functions

1
推荐指数
1
解决办法
7503
查看次数

firebase函数类型'Change <DataSnapshot>'中不存在属性'data'

我正在尝试部署firebase函数,我收到错误

src/index.ts(132,31):错误TS2339:"更改"类型中不存在属性"数据".src/index.ts(136,65):错误TS2339:"更改"类型中不存在属性'params'.src/index.ts(142,18):错误TS2339:"更改"类型中不存在属性"数据".

我的代码

    module.exports.onUserStatusChanged = functions.database
  .ref('/users/{uid}').onUpdate((event) => {
    // Get the data written to Realtime Database
    const eventStatus = event.data.val();

    // Then use other event data to create a reference to the
    // corresponding Firestore document.
    const userStatusFirestoreRef = firestore.doc(`users/${event.params.uid}`);

    // It is likely that the Realtime Database change that triggered
    // this event has already been overwritten by a fast change in
    // online / offline status, so we'll re-read the current data
    // and compare the timestamps. …
Run Code Online (Sandbox Code Playgroud)

javascript node.js firebase google-cloud-functions google-cloud-firestore

1
推荐指数
1
解决办法
2780
查看次数

用firebase电话身份验证失败响应本机

我正在尝试通过react-native-firebase文档使Firebase电话认证成为本机响应, 并且出现此错误

错误:此应用无权使用Firebase身份验证。请确认在Firebase控制台中配置了正确的软件包名称和SHA-1。[应用验证失败]

我已经创建了debug.keystore

keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 14000
Run Code Online (Sandbox Code Playgroud)

然后我得到了SHA1

keytool -list -alias androiddebugkey -keystore "C:\Users\adirz\.android\debug.keystore" -storepass android -keypass android
Run Code Online (Sandbox Code Playgroud)

并粘贴到Firebase控制台中,然后下载google-services.json并添加到我的react native应用中。然后我写的代码

    import React, { Component } from 'react';
import {
  View,
  Button,
  Text,
  TextInput,
  Image,
  ActivityIndicator,
  Platform,
} from 'react-native';

import firebase from 'react-native-firebase'

const imageUrl =
  'https://www.shareicon.net/data/512x512/2016/07/19/798524_sms_512x512.png';

export default class PhoneAuth extends Component {
  static getDefaultState() {
    return {
      error: '',
      codeInput: '',
      phoneNumber: '+44', …
Run Code Online (Sandbox Code Playgroud)

android firebase react-native

1
推荐指数
1
解决办法
2463
查看次数

反应导航返回不导航到上一个屏幕

我在我的react-native应用程序中使用新的react-navigation 2.16.0。

我有欢迎(登录和注册)屏幕,然后是主堆栈。主堆栈包括成功验证(登录\注册)后的所有屏幕。

MainStack = createStackNavigator(
            {
                Welcome: {
                    screen: Welcome, navigationOptions: {
                        gesturesEnabled: false,
                    }
                },
                Main: {
                    screen: App, navigationOptions: {
                        gesturesEnabled: false,
                    }
                }



            }, {
                headerMode: 'none',
                lazy: true,
                initialRouteName: UserStore.token ? 'Main' : 'Welcome',
                gesturesEnabled: false,
                cardStack: {
                    gesturesEnabled: false
                },
                cardStyle: {
                    elevation: 0,
                    shadowOpacity: 0,
                    borderBottomWidth: 0,
                    borderTopWidth: 0

                },
                transitionConfig: () => ({
                    containerStyle: {
                        elevation: 0,
                        shadowOpacity: 0,
                        borderBottomWidth: 0,
                        borderTopWidth: 0
                    }
                }),
            }
        )`
Run Code Online (Sandbox Code Playgroud)

主堆栈渲染

render() {


    // const …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation

1
推荐指数
2
解决办法
3万
查看次数

更新 Node.js 中的二进制文件

我正在尝试使用 Node.js 处理二进制文件。

我正在尝试从客户端接收二进制文件,打开二进制文件,转换为十六进制,替换数据并将新的二进制文件返回给客户端。

app.use('/read-binary-file',(req,res) => {
    try {
        let content = fs.readFileSync(file_path);
        console.log('content', content)
        res.status(200).send({content})
    }
    catch(err) {
        console.error(err);
    }
})
Run Code Online (Sandbox Code Playgroud)

我编写了采用现有文件并尝试读取它的代码。当我打印它时,我在缓冲区中得到它:

content <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... >
Run Code Online (Sandbox Code Playgroud)

我不确定如何将其转换为十六进制,然后尝试更改它...当我通过在线十六进制编辑器读取文件时,我将它们每行 16 位,这种方式非常方便。 …

javascript binaryfiles file node.js express

1
推荐指数
2
解决办法
2173
查看次数

反应原生导航自定义动画过渡

我正在使用react native v0.49,我正在尝试在导航到其他页面时实现自定义转换.我要做的是只为场景2到场景3的一个场景进行过渡.但不是所有的应用程序.这个例子我发现它适用于所有网络,所以我想只为一个屏幕和所有应用程序做,因为如果我这样做它将影响所有的应用程序,它不是我正在寻找的.任何的想法?

    class SceneOne extends Component {
    render() {
        return (
            <View>
                <Text>{'Scene One'}</Text>
            </View>
        )
    }
}
class SceneTwo extends Component {
    render() {
        return (
            <View>
                <Text>{'Scene Two'}</Text>
            </View>
        )
    }
}


let AppScenes = {
    SceneOne: {
        screen: SceneOne
    },
    SceneTwo: {
        screen: SceneTwo
    },


SceneThree: {
            screen: SceneTwo
        },
}

let MyTransition = (index, position) => {
    const inputRange = [index - 1, index, index + 1];
    const opacity = position.interpolate({
        inputRange,
        outputRange: [.8, 1, …
Run Code Online (Sandbox Code Playgroud)

navigation animation react-native

0
推荐指数
1
解决办法
6360
查看次数