angularjs

使用Angular cli创建ng库

社会主义新天地 提交于 2021-01-07 14:51:21
在实际开发中,会发现我们好多工作都是重复的,在代码层面,发现好多代码是可以被重用的。这样我们就可以建一个库,类似于java的库,来提高工作效率。 创建Angular项目 打开命令行终端, cd 到用于创建应用的目录下,执行创建Angular项目命令: ng new arsprojects -S 此命令将会创建一个新的Angular项目,文件夹名为 arsprojects 。 -S 参数表示不创建测试文件。我们创建的ng库都将依托于 arsprojects 项目,它只是作为ng库的容器存在,不需要建立测试。 用IDE打开 arsprojects 项目。 看到的文件结构就是我们常用的Angular项目结构。平时我们开发Angular项目,就是在 src/app 目录下进行的。 我们想建的是一个ng库,它和原来的Angular项目还是有一定差异的,ng库不需要操作 src/app 下的内容。 创建一个组件库 ng g library ars-components -p ars g 是generate的简写方式, library 表示我们创建的是一个库。 -p ars 表示我们创建的库里面的组件是以 ars 开头的。例如我们创建一个checkbox组件,那么他的selector就是 ars-checkbox ,在HTML中通过标签来使用我们组件。 执行完该命令后,在ide中会发现

AngularJS - mixing HTTP and custom promises with recursion

给你一囗甜甜゛ 提交于 2021-01-06 07:38:10
问题 I have written a function wrapper that returns cached values for HTTP responses. In a specific situation (marked by comment // <--HERE ) I see inconsistent behavior. I'm frankly not sure what exactly the inconsistency is, but bottom line, when the cache expires (has_expired), it does not wait for the http get to return in the recursive call. My guess is I haven't put a "return" somewhere on a promise but I can't find out where (and why). Do I need to put a return in front of localForage

AngularJS - mixing HTTP and custom promises with recursion

谁说我不能喝 提交于 2021-01-06 07:37:27
问题 I have written a function wrapper that returns cached values for HTTP responses. In a specific situation (marked by comment // <--HERE ) I see inconsistent behavior. I'm frankly not sure what exactly the inconsistency is, but bottom line, when the cache expires (has_expired), it does not wait for the http get to return in the recursive call. My guess is I haven't put a "return" somewhere on a promise but I can't find out where (and why). Do I need to put a return in front of localForage

AngularJS - mixing HTTP and custom promises with recursion

蹲街弑〆低调 提交于 2021-01-06 07:36:45
问题 I have written a function wrapper that returns cached values for HTTP responses. In a specific situation (marked by comment // <--HERE ) I see inconsistent behavior. I'm frankly not sure what exactly the inconsistency is, but bottom line, when the cache expires (has_expired), it does not wait for the http get to return in the recursive call. My guess is I haven't put a "return" somewhere on a promise but I can't find out where (and why). Do I need to put a return in front of localForage

图解Reformer:一种高效的Transformer

拟墨画扇 提交于 2021-01-06 05:26:34
点击上方“AI公园”,关注公众号,选择加“星标“或“置顶” 作者: Alireza Dirafzoon 编译:ronghuaiyang 导读 在单GPU上就可以运行的Transformer模型,而且几乎不损失精度,了解一下? 如果你一直在开发机器学习算法用于处理连续数据 —— 例如语言处理中的文本,语音信号,或视频 —— 你可能听说过或使用过Transformer,你可能知道这和是推特中认为的不同于一个东西。 图1,打破僵局,摘自Chris Manning教授的推特 最近,谷歌推出了Reformer架构,Transformer模型旨在有效地处理处理很长的时间序列的数据(例如,在语言处理多达100万个单词)。Reformer的执行只需要更少的内存消耗,并且即使在单个GPU上运行也可以获得非常好的性能。论文 Reformer: The efficient Transformer 将在ICLR 2020上发表(并在评审中获得了近乎完美的分数)。Reformer模型有望通过超越语言应用(如音乐、语音、图像和视频生成)对该领域产生重大影响。 在这篇文章中,我们将努力深入Reformer模型并试着去理解一些可视化方面的指南。准备好了吗? 为什么是Transformer? 在NLP类的任务中,如机器翻译、文本生成、问答,可以被形式化为sequence-to-sequence的学习问题。长短期记忆

高效的前端开发工具有哪些?

删除回忆录丶 提交于 2021-01-05 14:42:11
  高效的前端开发工具有哪些?在互联网中许多开发工具可以让前端开发人员的工作生活变得更加轻松。应用程序的功能越来越丰富,也导致了前端开发的复杂度大幅增加,急需好的开发工具。今天和大家分享一些前端开发常用工具,这些工具真的对于提高工作效率有很大的帮助。   高效的前端开发工具:   1、EnjoyCSS   运用CSS,非常简单的工具就是遇到困难时的救星。EnjoyCSS可以让你通过简单的UI设计你的元素,并且提供相关的CSS输出。   2、Prettier Playground   Prettier是一个代码格式化程序,支持JavaScript,包括ES2017、JSX、Angular、Vue、Flow、TypeScript等。它可以移除你的原始格式,并且将其替换为遵循最佳运行方式的、标准的一致样式。如此便捷的工具在我们的编辑器中十分流行,与此同时它还有一个线上版本,可以在线完成对代码格式的修正。   3、Postman   Postman就一直在我的开发人员工具集中。它在后端检查GET、POST、DELETE、OPTIONS和PUT在内的一系列端点这方面,起到了非常显著的作用。   4、StackBlitz   根据Chidume Nnamdi显示,StackBlitz是每名使用者都很喜欢的一款在线编辑工具。最重要的一点就是,它将IDE引入了web——Visual Studio

Get list of user email addresses with AngularFire

别来无恙 提交于 2021-01-05 11:51:42
问题 My web application uses Firebase JS + AngularFire to display a report of users in the application (visible only to admins). How can I retrieve a user's email address using AngularFire? Looking at the AngularFire API Reference, I don't see an available method for doing this in the $firebaseAuth section: https://github.com/firebase/angularfire/blob/master/docs/reference.md 回答1: You can't easily access that unless you go to the firebase console and do a manual check. In firebase it is advised

Angular UpgradeComponent cannot find $scope

懵懂的女人 提交于 2021-01-05 11:35:44
问题 I have a hybrid angular-cli that roughly follows Victor Savkin's Lazy Loaded AngularJS guide. AngularJS is bootstraped in the constructor of a LazyLoaded Angular module. The main difference between my app and the guide is that I am trying to wrap the <ui-view> directive inside of some Angular components. Because of how my layout is structured the <ui-view> element will not be available when AngularJS is bootstrapped and may be added or removed at any time. import { Component, Directive,

Angular UpgradeComponent cannot find $scope

流过昼夜 提交于 2021-01-05 11:34:41
问题 I have a hybrid angular-cli that roughly follows Victor Savkin's Lazy Loaded AngularJS guide. AngularJS is bootstraped in the constructor of a LazyLoaded Angular module. The main difference between my app and the guide is that I am trying to wrap the <ui-view> directive inside of some Angular components. Because of how my layout is structured the <ui-view> element will not be available when AngularJS is bootstrapped and may be added or removed at any time. import { Component, Directive,

Angular UpgradeComponent cannot find $scope

▼魔方 西西 提交于 2021-01-05 11:34:07
问题 I have a hybrid angular-cli that roughly follows Victor Savkin's Lazy Loaded AngularJS guide. AngularJS is bootstraped in the constructor of a LazyLoaded Angular module. The main difference between my app and the guide is that I am trying to wrap the <ui-view> directive inside of some Angular components. Because of how my layout is structured the <ui-view> element will not be available when AngularJS is bootstrapped and may be added or removed at any time. import { Component, Directive,