This is the most concise list of things you must know in order to upgrade your app to AngularJs v1.0 (subject to change). Read this list and upgrading should be as painless and easy as possible. REMEMBER: You should still refer to the docs for new syntax changes.
SUPA SIMPO UPGRADE TUTORIAL:
- The accepted convention is now
ng-whateverinstead ofng:whatever - Widgets have been dropped and folded into directives.
- Directives provide way more control and optional complexity if necessary.
- You can now set an execution priority over other directives on the same element
- You can now store a template inline or use a partial, both of which are automatically compiled
- You can now extend an existing directive's "controller" (read the docs, I'm still figuring this one out)
ng-transposelets you relocate and output the original element's innerHtml to a new location in the template which will continue compiling normally*
ng:autobindhas been dropped in favor of modules- Your app must have a module now (read the docs)
- Specify your module name in
ng-app(usually goes on<html>tag). - Modules can include other modules.
- Routes are done inside of modules
- You can do app-wide crap from modules like
.run(fn)which would hold init-code and.value()for globals or constants - Directives, services and filters are attached to modules now (read the docs)
- Refer to angular-ui as a good example of how to structure your app (source code)
- Specify your module name in
- There is no html filter, it's now a
ng-bind-html-unsafe="{expression}"directive - You probably want to output debugging variable through the
{{myVar | json}}filter $watchcallback is nowfn(newVal, oldVal)instead offn(scope, newVal, oldVal)thisis no longer a reference to scope, it is now a$scopeservice that is passed instead.- Scopes still inherit, controllers do not. Consider using your module +
$rootScopefor global stuff. Removed in RC5ng-modelnow fires on blur, you're probably looking forng-model-instant.$xhris now$httpand the syntax is slightly different
Comments