TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

On the Bleeding Edge: Advanced AngularJS Form Validation

17 点作者 anorborg将近 12 年前

1 comment

ianstormtaylor将近 12 年前
Can someone who is proficient in Angular explain to me why this many attributes are required on the form element itself:<p><pre><code> &lt;form ng-app=&quot;LoginApp&quot; ng-controller=&quot;LoginController&quot; ng-submit=&quot;login()&quot;&gt; </code></pre> This leads to my usual reaction to Angular: I&#x27;m sure they&#x27;ve got some things right, and I believe that data binding is the way to go, but holy shit that code is ugly and verbose. I&#x27;ve been using reactive.js [1] lately with Component [2] and its incredibly beautiful by contrast:<p><pre><code> &lt;form data-submit=&quot;login&quot;&gt; </code></pre> It uses data attributes, functions are handled for you automatically so you don&#x27;t have to write the parens all the time, it will fallback to the model automatically if the view doesn&#x27;t have a certain property. And the view is passed in so you don&#x27;t need to specify what controller or &quot;app&quot; to search for, which seems way less tightly coupled.<p>Really it&#x27;s one of the most beautiful libraries I&#x27;ve ever seen. So why would I ever want to use Angular?<p>I&#x27;m honestly curious since I&#x27;ve heard so many good things about Angular. It seems like they need a few more designers who can code on the team--people who care about the user experience part of API design.<p>[1]: <a href="https://github.com/component/reactive" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;component&#x2F;reactive</a> [2]: <a href="https://github.com/component/component" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;component&#x2F;component</a>
评论 #6084977 未加载
评论 #6084894 未加载
评论 #6087162 未加载