Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'll start with the piece of code that you find suspect and the fundamental difference between how it is handled in AngularJS vs. plain HTML and Javascript.</p> <blockquote> <p>This is basically HTML with Angular directives sprinkled in. The one that I find potentially susupect is this: <code>&lt;a href="" ng-click="archive()"&gt;archive&lt;/a&gt;</code>.</p> </blockquote> <p>This looks awfully similar to something we would have written 10 years ago:</p> <pre><code>&lt;a href="" onclick="archive()"&gt;archive&lt;/a&gt; </code></pre> <p>However, there is a fundamental difference between the above HTML and the AngularJS implementation. For AngularJS, the <code>archive</code> function is located on a scope that we control and can manipulate through the use of controllers. The raw JS example requires that <code>archive</code> be in the global namespace (which is bad for many reasons).</p> <p>But, we can still see what the <code>onclick</code> event binding was meant to do; it was meant enable one to declaratively build behavior into a view, and let JS handle the implementation details. AngularJS does this, <strong>AND</strong> provides a way to organize the difference scopes/contexts of our view in a way that is not possible with regular HTML. </p> <p>Yes, AngularJS involves extending HTML by moving more of the presentation and binding concerns into the view. The good news is we are heading that way with HTML6. Here are some select quotes from <a href="http://html6spec.com/">http://html6spec.com/</a>:</p> <blockquote> <p>Imagine being able to mark something up the way you want to mark it up. Imagine changing <code>&lt;div id="wrapper"&gt;</code> to <code>&lt;wrapper&gt;</code>...</p> <p>The web is moving towards a giant app store and we need to embrace it. The markup we use shouldn't work against us, it should work for us. This spec is to do just that. To finally break free of fatuous rules and standards and to give us, developers, total freedom to code as we please bringing the web a more semantic, clean, and human readable markup.</p> </blockquote> <p>In a way, AngularJS brings us all the goodness of HTML6, but allows us to use it today. How the web is used has changed drastically in the past 15 years and our tools are still lagging very far behind. Lucky for us, the future is a beacon of light and hope, and AngularJS brings the future back to the present.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload