Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

javascript - Angular Realtime Firebase数据库(Angular Realtime Firebase Database)

Need help on how to use angular with firebase for realtime data,

(需要有关如何在Firebase中使用angular来获取实时数据的帮助,)

what i have done

(我做了什么)


-I have done all installed and imported the firebase sdk

(-我已完成所有安装并导入了Firebase SDK)


-Configured the environment file with the firebase api

(-使用firebase api配置环境文件)

what i want as a result

(结果我想要什么)


-I want to post the form input to my forebase realtime storage

(-我想将表单输入发布到我的forebase实时存储中)


-Read and write the input data in my angular app

(-在我的角度应用程序中读写输入数据)

result im getting

(结果即时通讯)


if i submit the form nothing really happens in my browser console and firebase console.

(如果我提交表单,则在浏览器控制台和Firebase控制台中什么也不会发生。)

Please im now learning and would be glad for an assistance and correction.

(请即时学习,很高兴为您提供帮助和更正。)

source https://firebase.google.com/docs/database/web/read-and-write

(来源https://firebase.google.com/docs/database/web/read-and-write)

send.component.ts

(send.component.ts)


 <form (ngSubmit)="this.authService.wire_Transfer" novalidate>
        <div class="authBlock2">
          <span style="color: brown;">Enter details for Wire transfer</span>
          <div class="formGroup">
            <input type="text" class="formControl" matInput placeholder="Enter Recipient Name "
               name="recipient" />
          </div>
           <div class="formGroup">
            <input type="text" class="formControl" matInput placeholder="Enter Recipint Bank "
              name="bank" />
          </div>
          <div class="formGroup">
            <input type="text" class="formControl" placeholder="Account Number" 
               name="account" />
          </div>
          <div class="formGroup">
            <input type="text" class="formControl" matInput placeholder="Enter Amount "
               name="amount" />
          </div>          
          <div class="formGroup">
            <input type="text" class="formControl" placeholder="Enter your PIN" 
            name="pin" #pin = "ngModel"/> />
          </div>                        
          <div class="formGroup">
            <button mat-raised-button data-toggle="modal" type="submit" >sen</button>

          </div>
        </div>

      </form>




auth.service.ts

(验证服务)

Transfer(userId, name, bank, account, amount,) {
  firebase.database().ref('transfer/' + userId).set({
    name: name,
    bank: bank,
    account : account,
    amount: amount
  });
}

  ask by Joey translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...