Mastering Web Application

(Rick Simeone) #1

Packaging and Deploying AngularJS Web Applications


document.createElement('ng-view');

...
<![endif]-->



Custom elements must be created in a script located in the <head>
section of the page. This is to assure that it runs before the parser
sees the new element type.

Of course we can side step aside the whole problem of custom HTML tags by using
the attribute-version of the ng-include directive as follows:


<div ng-include="'myInclude.tpl.html'"></div>

Supporting IE7 is even more problematic. To start with, you will need to take care of
all the steps required for IE8. But IE7 is not part of the integration build and tests, so
there is no guarantee that all the AngularJS functionality will be supported on this
browser. On top of this, IE7 lacks many of the APIs commonly present in modern
browsers. The best example is JSON API that isn't implemented in IE7, and thus
requires a polyfill (http://bestiejs.github.io/json3/).


IE6 is not supported.


AngularJS documentation has a comprehensive section describing
all the steps necessary to support IE 8 and IE 7: http://docs.
angularjs.org/guide/ie.

Summary


This chapter revolved around deployment-related concerns. We started off by
discussing various network-related optimization techniques. In general, we can
reduce the time a browser is spending on network-related tasks by pushing fewer
bytes over the wire and limiting the number of individual requests.


Minification of HTML, CSS, and JavaScript files is a common technique used to
trim down the number of bytes to be downloaded by a browser. The specification
of the AngularJS Dependency Injection machinery forces us to write our JavaScript
code in a minification-safe way. In practice it means that we should use array-style
annotations for all the functions that declare dependencies to be resolved by the
AngularJS DI subsystem.

Free download pdf