百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

abourget-angular

> 编程语言
开源

可重复使用的 AngularJS 工具和指令

100 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

可重复使用的 AngularJS 工具和指令

Widgets and tools for AngularJS development.

Often components I was reusing everywhere.

$watch fighters

I often had to show on the screen large amount of informations, like tables, graphs or other heavyweight data. Using AngularJS, if I used the native and quick data-binding notation, I would very quickly overload the page with $watches. The AngularJS devs suggest not more than 2000 watches per page before you start to see performance decreases.

2000 is a lot of moving parts, and if you have 2000 dynamically bound data components in one page, you're most probably overloading your user's brain. This doesn't mean you can't have 2000 data elements on a page. For example, if you have a grid that shows small numbers in an Excel-like fashion, especially if each cell has two bindings or more (with a title attribute with bound information, etc..), you can easily hit that 2000 $watch cap (not that Angular will prevent you from doing it, it's just bad practice). But most of the time, all that information displayed on a screen is not going to change, or not all at the same time. You probably won't have 2000 cells with data flowing through. And even then, if you had 2000 cells with data flowing and changing in real-time, it would probably be a bad user experience (who can grasp the meaning of all those numbers flowing ?).

Ssssoo, long story short, I wanted bindings that would work the same as native bindings, but that wouldn't trigger $watches. That would be $interpolated the first time, and would never move. For that I wrote those simple set-... directives.

There is:

  • set-title, which sets the title attribute once and for all

  • set-href, sets the href attribute

  • set-text, which sets the .text() content (using jQuery)

  • set-html, which sets the .html() content (using jQuery again)

  • set-class, which adds the class returned by the expression (using jQ's .addClass())

  • set-if, which renders the content only if its evaluated expression is truthy. It is different from ng-show/ng-hide as the contents of the element will not be added to the DOM. It is also different from angular-ui's ui-if directive, as it is only evaluated once and does not set a $watch.

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言