简体   繁体   English

Angular应用程序中的Firebase UI Auth小部件

[英]Firebase UI Auth widget in Angular application

I only want to include the FirebaseUI Auth widget on my login page (controlled via ngRoute). 我只想在登录页面上包含FirebaseUI Auth小部件(通过ngRoute控制)。

However, the top-level JS throws this error on all other pages: 但是,顶级JS会在所有其他页面上抛出此错误:

"Uncaught Error: Could not find the Firebase UI widget element on the page." “未捕获错误:无法在页面上找到Firebase UI小部件元素。”

While the error is technically correct, it's annoying as that widget shouldn't be on all pages. 虽然错误在技术上是正确的,但它很烦人,因为该窗口小部件不应该在所有页面上。

Has anyone thought of a neat way to suppress this? 有没有人想过用这种方法来压制这个?

Thanks, Ned 谢谢,奈德

You need Firebase Auth to work across all pages that require authentication, therefore you will need to have the Firebase Web SDK/Javascript loaded for those pages. 您需要Firebase Auth才能在需要身份验证的所有网页上工作,因此您需要为这些网页加载Firebase Web SDK / Javascript。 As for the widget element not being there, is there not a set of elements required for the widget to work with? 至于widget元素不存在,是否有一组元素需要使用?

If there are, add them. 如果有,请添加它们。 If there is not, they should be loaded by the SDK automatically (like how it loads iFrames in the regular Web SDK). 如果没有,它们应该由SDK自动加载(就像它在常规Web SDK中加载iFrames一样)。 The console is telling you the elements are missing. 控制台告诉你缺少元素。

I know you will get richer error handling/messages if you host the firebase scripts vs loading them via CDN. 我知道如果您托管firebase脚本而不是通过CDN加载它们,您将获得更丰富的错误处理/消息。 You could try that. 你可以试试。

If you want to hide the widget elements, it seems like CSS could display:none you might have to add the !important declaration. 如果你想隐藏widget元素,似乎CSS可以display:none你可能不得不添加!important声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM