├── examples ├── outdated │ ├── phone-kitten │ │ ├── css │ │ │ ├── .gitkeep │ │ │ ├── app.css │ │ │ └── animations.css │ │ ├── img │ │ │ ├── .gitkeep │ │ │ ├── phones │ │ │ │ ├── lg-axis.0.jpg │ │ │ │ ├── lg-axis.1.jpg │ │ │ │ ├── lg-axis.2.jpg │ │ │ │ ├── nexus-s.0.jpg │ │ │ │ ├── nexus-s.1.jpg │ │ │ │ ├── nexus-s.2.jpg │ │ │ │ ├── nexus-s.3.jpg │ │ │ │ ├── dell-venue.0.jpg │ │ │ │ ├── dell-venue.1.jpg │ │ │ │ ├── dell-venue.2.jpg │ │ │ │ ├── dell-venue.3.jpg │ │ │ │ ├── dell-venue.4.jpg │ │ │ │ ├── dell-venue.5.jpg │ │ │ │ ├── samsung-gem.0.jpg │ │ │ │ ├── samsung-gem.1.jpg │ │ │ │ ├── samsung-gem.2.jpg │ │ │ │ ├── sanyo-zio.0.jpg │ │ │ │ ├── sanyo-zio.1.jpg │ │ │ │ ├── sanyo-zio.2.jpg │ │ │ │ ├── t-mobile-g2.0.jpg │ │ │ │ ├── t-mobile-g2.1.jpg │ │ │ │ ├── t-mobile-g2.2.jpg │ │ │ │ ├── dell-streak-7.0.jpg │ │ │ │ ├── dell-streak-7.1.jpg │ │ │ │ ├── dell-streak-7.2.jpg │ │ │ │ ├── dell-streak-7.3.jpg │ │ │ │ ├── dell-streak-7.4.jpg │ │ │ │ ├── motorola-xoom.0.jpg │ │ │ │ ├── motorola-xoom.1.jpg │ │ │ │ ├── motorola-xoom.2.jpg │ │ │ │ ├── motorola-atrix-4g.0.jpg │ │ │ │ ├── motorola-atrix-4g.1.jpg │ │ │ │ ├── motorola-atrix-4g.2.jpg │ │ │ │ ├── motorola-atrix-4g.3.jpg │ │ │ │ ├── samsung-galaxy-tab.0.jpg │ │ │ │ ├── samsung-galaxy-tab.1.jpg │ │ │ │ ├── samsung-galaxy-tab.2.jpg │ │ │ │ ├── samsung-galaxy-tab.3.jpg │ │ │ │ ├── samsung-galaxy-tab.4.jpg │ │ │ │ ├── samsung-galaxy-tab.5.jpg │ │ │ │ ├── samsung-galaxy-tab.6.jpg │ │ │ │ ├── samsung-transform.0.jpg │ │ │ │ ├── samsung-transform.1.jpg │ │ │ │ ├── samsung-transform.2.jpg │ │ │ │ ├── samsung-transform.3.jpg │ │ │ │ ├── samsung-transform.4.jpg │ │ │ │ ├── droid-pro-by-motorola.0.jpg │ │ │ │ ├── droid-pro-by-motorola.1.jpg │ │ │ │ ├── t-mobile-mytouch-4g.0.jpg │ │ │ │ ├── t-mobile-mytouch-4g.1.jpg │ │ │ │ ├── t-mobile-mytouch-4g.2.jpg │ │ │ │ ├── t-mobile-mytouch-4g.3.jpg │ │ │ │ ├── t-mobile-mytouch-4g.4.jpg │ │ │ │ ├── t-mobile-mytouch-4g.5.jpg │ │ │ │ ├── droid-2-global-by-motorola.0.jpg │ │ │ │ ├── droid-2-global-by-motorola.1.jpg │ │ │ │ ├── droid-2-global-by-motorola.2.jpg │ │ │ │ ├── motorola-xoom-with-wi-fi.0.jpg │ │ │ │ ├── motorola-xoom-with-wi-fi.1.jpg │ │ │ │ ├── motorola-xoom-with-wi-fi.2.jpg │ │ │ │ ├── motorola-xoom-with-wi-fi.3.jpg │ │ │ │ ├── motorola-xoom-with-wi-fi.4.jpg │ │ │ │ ├── motorola-xoom-with-wi-fi.5.jpg │ │ │ │ ├── motorola-bravo-with-motoblur.0.jpg │ │ │ │ ├── motorola-bravo-with-motoblur.1.jpg │ │ │ │ ├── motorola-bravo-with-motoblur.2.jpg │ │ │ │ ├── motorola-charm-with-motoblur.0.jpg │ │ │ │ ├── motorola-charm-with-motoblur.1.jpg │ │ │ │ ├── motorola-charm-with-motoblur.2.jpg │ │ │ │ ├── motorola-defy-with-motoblur.0.jpg │ │ │ │ ├── motorola-defy-with-motoblur.1.jpg │ │ │ │ ├── motorola-defy-with-motoblur.2.jpg │ │ │ │ ├── samsung-showcase-a-galaxy-s-phone.0.jpg │ │ │ │ ├── samsung-showcase-a-galaxy-s-phone.1.jpg │ │ │ │ ├── samsung-showcase-a-galaxy-s-phone.2.jpg │ │ │ │ ├── samsung-mesmerize-a-galaxy-s-phone.0.jpg │ │ │ │ ├── samsung-mesmerize-a-galaxy-s-phone.1.jpg │ │ │ │ ├── samsung-mesmerize-a-galaxy-s-phone.2.jpg │ │ │ │ └── samsung-mesmerize-a-galaxy-s-phone.3.jpg │ │ │ ├── glyphicons-halflings.png │ │ │ └── glyphicons-halflings-white.png │ │ ├── js │ │ │ ├── filters.js │ │ │ ├── services.js │ │ │ └── animations.js │ │ ├── components │ │ │ ├── phone-list │ │ │ │ ├── phone-list.js │ │ │ │ └── phone-list.html │ │ │ └── phone-detail │ │ │ │ ├── phone-detail.js │ │ │ │ └── phone-detail.html │ │ ├── app.js │ │ ├── index.html │ │ ├── phones │ │ │ ├── sanyo-zio.json │ │ │ ├── motorola-xoom.json │ │ │ ├── motorola-atrix-4g.json │ │ │ ├── motorola-bravo-with-motoblur.json │ │ │ ├── motorola-charm-with-motoblur.json │ │ │ ├── t-mobile-g2.json │ │ │ ├── motorola-xoom-with-wi-fi.json │ │ │ ├── lg-axis.json │ │ │ ├── motorola-defy-with-motoblur.json │ │ │ ├── droid-pro-by-motorola.json │ │ │ ├── samsung-gem.json │ │ │ ├── droid-2-global-by-motorola.json │ │ │ ├── dell-streak-7.json │ │ │ ├── samsung-showcase-a-galaxy-s-phone.json │ │ │ ├── t-mobile-mytouch-4g.json │ │ │ ├── samsung-mesmerize-a-galaxy-s-phone.json │ │ │ ├── samsung-transform.json │ │ │ ├── dell-venue.json │ │ │ ├── nexus-s.json │ │ │ ├── samsung-galaxy-tab.json │ │ │ └── phones.json │ │ └── scenario.js │ ├── sibbling-routes │ │ ├── components │ │ │ ├── posts │ │ │ │ └── posts.html │ │ │ └── users │ │ │ │ └── users.html │ │ ├── app.css │ │ ├── app.js │ │ └── index.html │ ├── animation │ │ ├── components │ │ │ ├── goodbye │ │ │ │ ├── goodbye.html │ │ │ │ └── goodbye.js │ │ │ └── welcome │ │ │ │ ├── welcome.html │ │ │ │ └── welcome.js │ │ ├── app.js │ │ ├── scenario.js │ │ ├── app.css │ │ └── index.html │ ├── hello │ │ ├── components │ │ │ ├── welcome │ │ │ │ ├── welcome.html │ │ │ │ └── welcome.js │ │ │ ├── flickr │ │ │ │ ├── flickr.html │ │ │ │ └── flickr.js │ │ │ └── settings │ │ │ │ ├── settings.html │ │ │ │ └── settings.js │ │ ├── scenario.js │ │ ├── app.js │ │ └── index.html │ ├── wizard │ │ ├── components │ │ │ ├── intro │ │ │ │ ├── intro.js │ │ │ │ └── intro.html │ │ │ ├── one │ │ │ │ ├── one.js │ │ │ │ └── one.html │ │ │ ├── two │ │ │ │ ├── two.html │ │ │ │ └── two.js │ │ │ ├── end │ │ │ │ ├── end.html │ │ │ │ └── end.js │ │ │ └── three │ │ │ │ ├── three.html │ │ │ │ └── three.js │ │ ├── app.js │ │ └── index.html │ └── confirm-unsaved │ │ ├── components │ │ ├── index │ │ │ ├── index.js │ │ │ └── index.html │ │ ├── save-modal │ │ │ ├── save-modal.html │ │ │ ├── save-modal.css │ │ │ └── save-modal.js │ │ └── edit-post │ │ │ ├── edit-post.html │ │ │ └── edit-post.js │ │ ├── app.js │ │ ├── index.html │ │ └── scenario.js └── heroes │ ├── lib │ └── angular-component-router.js │ ├── app │ ├── dialog.js │ ├── crisis-center │ │ ├── crisisDetail.html │ │ ├── crisis-overview.html │ │ ├── crisis-overview.js │ │ ├── crisis-center.js │ │ └── crisis-detail.js │ ├── app.js │ └── heroes.js │ ├── index.html │ └── styles.css ├── shims └── angular2 │ ├── src │ ├── facade │ │ ├── exceptions.js │ │ ├── async.js │ │ ├── lang.js │ │ └── collection.js │ └── core │ │ └── reflection │ │ └── reflection.js │ └── core.js ├── .gitignore ├── src ├── router │ ├── lifecycle │ │ ├── lifecycle_annotations.js │ │ └── route_lifecycle_reflector.js │ ├── route_config │ │ └── route_config_decorator.js │ ├── location │ │ └── location.js │ └── route_registry_factory.js ├── ngLink.js ├── ngComponentRouter.js └── ngOutlet.js ├── .npmignore ├── README.md ├── .editorconfig ├── webpack.config.js ├── scripts └── copy_files.js ├── karma.config.js ├── package.json ├── LICENSE ├── test ├── integration │ ├── animation_spec.js │ ├── ngRoute_shim_spec.js │ ├── router_spec.js │ └── navigation_spec.js ├── util.es5.js └── ng_link_spec.js ├── DOCUMENTATION.md └── CONTRIBUTING.md /examples/outdated/phone-kitten/css/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /shims/angular2/src/facade/exceptions.js: -------------------------------------------------------------------------------- 1 | exports.BaseException = Error; 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .idea 4 | .DS_STORE 5 | tmp 6 | npm-debug.log 7 | -------------------------------------------------------------------------------- /examples/heroes/lib/angular-component-router.js: -------------------------------------------------------------------------------- 1 | ../../../dist/angular-component-router.js -------------------------------------------------------------------------------- /examples/outdated/sibbling-routes/components/posts/posts.html: -------------------------------------------------------------------------------- 1 |
2 |

Posts

3 |
4 | -------------------------------------------------------------------------------- /examples/outdated/sibbling-routes/components/users/users.html: -------------------------------------------------------------------------------- 1 |
2 |

Users

3 |
4 | -------------------------------------------------------------------------------- /src/router/lifecycle/lifecycle_annotations.js: -------------------------------------------------------------------------------- 1 | // Empty file to clear out the Angular 2 annotations stuff -------------------------------------------------------------------------------- /examples/outdated/animation/components/goodbye/goodbye.html: -------------------------------------------------------------------------------- 1 |
2 |

{{goodbye.heading}}

3 |
4 | -------------------------------------------------------------------------------- /examples/outdated/animation/components/welcome/welcome.html: -------------------------------------------------------------------------------- 1 |
2 |

{{welcome.heading}}

3 |
4 | -------------------------------------------------------------------------------- /examples/outdated/hello/components/welcome/welcome.html: -------------------------------------------------------------------------------- 1 |
2 |

{{welcome.heading}}

3 |
4 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/lg-axis.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/lg-axis.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/lg-axis.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/lg-axis.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/lg-axis.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/lg-axis.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/nexus-s.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/nexus-s.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/nexus-s.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/nexus-s.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/nexus-s.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/nexus-s.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/nexus-s.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/nexus-s.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-venue.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-venue.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-venue.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-venue.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-venue.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-venue.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-venue.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-venue.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-venue.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-venue.4.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-venue.5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-venue.5.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-gem.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-gem.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-gem.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-gem.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-gem.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-gem.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/sanyo-zio.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/sanyo-zio.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/sanyo-zio.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/sanyo-zio.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/sanyo-zio.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/sanyo-zio.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-g2.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-g2.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-g2.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-g2.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-g2.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-g2.2.jpg -------------------------------------------------------------------------------- /examples/outdated/sibbling-routes/app.css: -------------------------------------------------------------------------------- 1 | 2 | .container { 3 | display: flex; 4 | flex-flow: row; 5 | } 6 | 7 | [ng-outlet] { 8 | flex: 1; 9 | } 10 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-streak-7.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-streak-7.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-streak-7.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-streak-7.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-streak-7.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-streak-7.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-streak-7.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-streak-7.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/dell-streak-7.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/dell-streak-7.4.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-atrix-4g.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.4.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.5.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-galaxy-tab.6.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-transform.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-transform.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-transform.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-transform.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-transform.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-transform.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-transform.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-transform.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-transform.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-transform.4.jpg -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | .idea 3 | bower_components 4 | chromedriver 5 | examples 6 | scripts 7 | compiled 8 | node_modules 9 | npm-debug.log 10 | sauce_connect.log 11 | temp 12 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/droid-pro-by-motorola.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/droid-pro-by-motorola.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/droid-pro-by-motorola.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/droid-pro-by-motorola.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.4.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/t-mobile-mytouch-4g.5.jpg -------------------------------------------------------------------------------- /examples/outdated/wizard/components/intro/intro.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.intro', []). 2 | controller('IntroController', [IntroController]); 3 | 4 | function IntroController () {} 5 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/droid-2-global-by-motorola.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/droid-2-global-by-motorola.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/droid-2-global-by-motorola.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/droid-2-global-by-motorola.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/droid-2-global-by-motorola.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/droid-2-global-by-motorola.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.4.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-xoom-with-wi-fi.5.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-bravo-with-motoblur.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-bravo-with-motoblur.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-bravo-with-motoblur.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-bravo-with-motoblur.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-bravo-with-motoblur.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-bravo-with-motoblur.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-charm-with-motoblur.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-charm-with-motoblur.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-charm-with-motoblur.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-charm-with-motoblur.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-charm-with-motoblur.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-charm-with-motoblur.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-defy-with-motoblur.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-defy-with-motoblur.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-defy-with-motoblur.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-defy-with-motoblur.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/motorola-defy-with-motoblur.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/motorola-defy-with-motoblur.2.jpg -------------------------------------------------------------------------------- /shims/angular2/src/core/reflection/reflection.js: -------------------------------------------------------------------------------- 1 | exports.reflector = { 2 | annotations: function (fn) { 3 | //TODO: implement me 4 | return fn.annotations || []; 5 | } 6 | }; 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-showcase-a-galaxy-s-phone.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-showcase-a-galaxy-s-phone.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-showcase-a-galaxy-s-phone.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-showcase-a-galaxy-s-phone.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-showcase-a-galaxy-s-phone.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-showcase-a-galaxy-s-phone.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.0.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.1.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.2.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angular/router/HEAD/examples/outdated/phone-kitten/img/phones/samsung-mesmerize-a-galaxy-s-phone.3.jpg -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/js/filters.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('phoneKitten.filters', []).filter('checkmark', function() { 4 | return function(input) { 5 | return input ? '\u2713' : '\u2718'; 6 | }; 7 | }); 8 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/index/index.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.index', []). 2 | controller('IndexController', ['posts', IndexController]); 3 | 4 | function IndexController (posts) { 5 | this.posts = posts; 6 | } 7 | -------------------------------------------------------------------------------- /examples/heroes/app/dialog.js: -------------------------------------------------------------------------------- 1 | angular.module('dialog', []) 2 | 3 | .service('dialogService', DialogService); 4 | 5 | function DialogService($q) { 6 | this.confirm = function(message) { 7 | return $q.when(window.confirm(message || 'Is it OK?')); 8 | }; 9 | } -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/index/index.html: -------------------------------------------------------------------------------- 1 |

Post Index

2 | 3 | 10 | -------------------------------------------------------------------------------- /examples/outdated/hello/components/welcome/welcome.js: -------------------------------------------------------------------------------- 1 | angular.module('example.welcome', []). 2 | controller('WelcomeController', WelcomeController); 3 | 4 | function WelcomeController() { 5 | this.heading = 'Welcome to The New Angular Router Demo!'; 6 | } 7 | -------------------------------------------------------------------------------- /examples/outdated/animation/components/goodbye/goodbye.js: -------------------------------------------------------------------------------- 1 | angular.module('example.goodbye', []). 2 | controller('GoodbyeController', GoodbyeController); 3 | 4 | function GoodbyeController() { 5 | this.heading = 'Goodbye to The New Angular Router Demo :('; 6 | } 7 | -------------------------------------------------------------------------------- /examples/outdated/animation/components/welcome/welcome.js: -------------------------------------------------------------------------------- 1 | angular.module('example.welcome', []). 2 | controller('WelcomeController', WelcomeController); 3 | 4 | function WelcomeController() { 5 | this.heading = 'Welcome to The New Angular Router Demo!'; 6 | } 7 | -------------------------------------------------------------------------------- /examples/outdated/wizard/components/one/one.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.one', []). 2 | controller('OneController', ['answers', OneController]); 3 | 4 | function OneController (answers) { 5 | this.answers = answers; 6 | this.question = 'What...is your name?'; 7 | } 8 | -------------------------------------------------------------------------------- /src/router/route_config/route_config_decorator.js: -------------------------------------------------------------------------------- 1 | var routes = require('./route_config_impl'); 2 | 3 | exports.Route = routes.Route; 4 | exports.Redirect = routes.Redirect; 5 | exports.AuxRoute = routes.AuxRoute; 6 | exports.AsyncRoute = routes.AsyncRoute; 7 | exports.RouteDefinition = routes.RouteDefinition; -------------------------------------------------------------------------------- /examples/outdated/wizard/components/two/two.html: -------------------------------------------------------------------------------- 1 |
2 |

{{ two.question }}

3 | 4 | 8 |
9 | -------------------------------------------------------------------------------- /examples/outdated/wizard/components/end/end.html: -------------------------------------------------------------------------------- 1 |
2 |

Right, off you go.

3 | 8 |
9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecated / Defunct / Non-working 2 | 3 | This repository used to contain a version of the router, which is now deprecated. 4 | 5 | If you are interested in the recommended component router, please look in the Angular 2 6 | repository at https://github.com/angular/angular/tree/master/modules/%40angular/router 7 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/save-modal/save-modal.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /examples/outdated/wizard/components/one/one.html: -------------------------------------------------------------------------------- 1 |
2 |

{{ one.question }}

3 | 4 | 5 | 9 |
10 | -------------------------------------------------------------------------------- /examples/outdated/wizard/components/three/three.html: -------------------------------------------------------------------------------- 1 |
2 |

{{ three.question }}

3 | 4 | 8 |
9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | [**.*] 13 | indent_style = space 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/edit-post/edit-post.html: -------------------------------------------------------------------------------- 1 |

Editing post "{{editPost.post.title}}"

2 | Back 3 |
4 |
5 | 6 |
7 | -------------------------------------------------------------------------------- /shims/angular2/core.js: -------------------------------------------------------------------------------- 1 | function OpaqueToken(desc) { 2 | this._desc = desc; 3 | } 4 | 5 | OpaqueToken.prototype.toString = function() { 6 | return 'Token ' + this._desc; 7 | }; 8 | 9 | exports.OpaqueToken = OpaqueToken; 10 | exports.Injectable = function() { return function() {}; }; 11 | exports.Inject = function() { return function() {}; }; -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/js/services.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('phoneKitten.services', ['ngResource']). 4 | factory('Phone', ['$resource', Phone]); 5 | 6 | function Phone($resource) { 7 | return $resource('phones/:phoneId.json', {}, { 8 | query: {method:'GET', params:{phoneId:'phones'}, isArray:true} 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | context: __dirname + '/tmp', 3 | entry: './ngComponentRouter.js', 4 | output: { 5 | path: __dirname + '/dist', 6 | pathInfo: true, 7 | filename: 'angular-component-router.js' 8 | }, 9 | resolve: { 10 | root: __dirname + '/shims', 11 | }, 12 | debug: true, 13 | devtool: 'source-map' 14 | }; -------------------------------------------------------------------------------- /examples/outdated/wizard/components/end/end.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.end', []). 2 | controller('EndController', ['answers', EndController]); 3 | 4 | function EndController(answers) { 5 | this.answers = answers; 6 | } 7 | 8 | EndController.prototype.canActivate = function() { 9 | return this.answers.name && this.answers.quest && this.answers.favoriteColor; 10 | }; 11 | -------------------------------------------------------------------------------- /examples/outdated/wizard/components/two/two.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.two', []). 2 | controller('TwoController', ['answers', TwoController]); 3 | 4 | function TwoController(answers) { 5 | this.answers = answers; 6 | this.question = 'What...is your quest?'; 7 | } 8 | 9 | TwoController.prototype.canActivate = function () { 10 | return !!this.answers.name; 11 | }; 12 | -------------------------------------------------------------------------------- /examples/outdated/hello/components/flickr/flickr.html: -------------------------------------------------------------------------------- 1 |
2 |

{{flickr.heading}}

3 |
4 |
5 | 6 | 7 | 8 |
9 |
10 |
11 | -------------------------------------------------------------------------------- /examples/outdated/wizard/components/intro/intro.html: -------------------------------------------------------------------------------- 1 |
2 |

STOP!

3 |

4 | He who would cross the Bridge of Death
5 | Must answer me
6 | These questions three
7 | Ere the other side he see. 8 |

9 | 10 | 11 | Ask me your questions, Bridgekeeper. I am not afraid. 12 | 13 |
14 | -------------------------------------------------------------------------------- /examples/heroes/app/crisis-center/crisisDetail.html: -------------------------------------------------------------------------------- 1 |
2 |

"{{$ctrl.editName}}"

3 |
4 | {{$ctrl.crisis.id}}
5 |
6 | 7 | 8 |
9 | 10 | 11 |
-------------------------------------------------------------------------------- /examples/outdated/wizard/components/three/three.js: -------------------------------------------------------------------------------- 1 | 2 | angular.module('myApp.three', []). 3 | controller('ThreeController', ['answers', ThreeController]); 4 | 5 | function ThreeController(answers) { 6 | this.answers = answers; 7 | this.question = 'What...is your favorite color?'; 8 | } 9 | 10 | ThreeController.prototype.canActivate = function () { 11 | return this.answers.name && this.answers.quest; 12 | }; 13 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/components/phone-list/phone-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('phoneKitten.phoneList', []). 4 | controller('PhoneListController', ['Phone', PhoneListController]); 5 | 6 | function PhoneListController(Phone) { 7 | this.Phone = Phone; 8 | this.orderProp = 'age'; 9 | } 10 | 11 | PhoneListController.prototype.activate = function() { 12 | this.phones = this.Phone.query(); 13 | }; 14 | -------------------------------------------------------------------------------- /examples/outdated/sibbling-routes/app.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp', [ 2 | 'ngNewRouter' 3 | ]) 4 | .controller('AppController', ['$router', AppController]); 5 | 6 | AppController.$routeConfig = [ 7 | { path: '/', redirectTo: '/users/posts' }, 8 | { path: '/users/posts', components: { left: 'users', right: 'posts' } }, 9 | { path: '/posts/users', components: { left: 'posts', right: 'users' } }, 10 | ]; 11 | function AppController($router) {} 12 | -------------------------------------------------------------------------------- /examples/outdated/hello/scenario.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var appRoot = 'examples/angular-1/hello'; 4 | 5 | describe('angular 1.x Hello App', function() { 6 | beforeEach(function() { 7 | browserGet('index.html'); 8 | }); 9 | 10 | xit('should work', function() { 11 | expect(element(by.binding('welcome.heading')).getText()) 12 | .toBe('Welcome to The New Angular Router Demo!'); 13 | }); 14 | }); 15 | 16 | function browserGet (url) { 17 | browser.get(appRoot + '/' + url); 18 | } 19 | -------------------------------------------------------------------------------- /examples/outdated/animation/app.js: -------------------------------------------------------------------------------- 1 | angular.module('example', [ 2 | 'example.goodbye', 3 | 'example.welcome', 4 | 'ngAnimate', 5 | 'ngNewRouter' 6 | ]) 7 | .controller('AppController', ['$router', AppController]); 8 | 9 | AppController.$routeConfig = [ 10 | { path: '/', redirectTo: '/welcome' }, 11 | { path: '/welcome', component: 'welcome' }, 12 | { path: '/goodbye', component: 'goodbye' } 13 | ]; 14 | function AppController($router) { 15 | this.greeting = 'Hello'; 16 | } 17 | -------------------------------------------------------------------------------- /examples/outdated/animation/scenario.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var appRoot = 'examples/angular-1/animation'; 4 | 5 | describe('angular 1.x Hello App', function() { 6 | beforeEach(function() { 7 | browserGet('index.html'); 8 | }); 9 | 10 | it('should work', function() { 11 | expect(element(by.binding('welcome.heading')).getText()) 12 | .toBe('Welcome to The New Angular Router Demo!'); 13 | }); 14 | }); 15 | 16 | function browserGet (url) { 17 | browser.get(appRoot + '/' + url); 18 | } 19 | -------------------------------------------------------------------------------- /examples/outdated/animation/app.css: -------------------------------------------------------------------------------- 1 | 2 | ng-outlet { 3 | display: block; 4 | } 5 | 6 | .ng-enter { 7 | opacity: 0; 8 | } 9 | 10 | .ng-enter.ng-enter-active { 11 | opacity: 1; 12 | } 13 | 14 | .ng-animate, 15 | .ng-enter, 16 | .ng-leave { 17 | -webkit-transition: 0.5s linear all; 18 | -moz-transition: 0.5s linear all; 19 | -o-transition: 0.5s linear all; 20 | transition: 0.5s linear all; 21 | } 22 | 23 | .ng-leave { 24 | opacity: 1; 25 | } 26 | 27 | .ng-leave.ng-leave-active { 28 | opacity: 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/outdated/hello/components/settings/settings.html: -------------------------------------------------------------------------------- 1 |
2 |

{{settings.heading}}

3 |
4 |
5 | 10 |
11 |
12 | 13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /examples/outdated/hello/components/settings/settings.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('example.settings', []). 4 | controller('SettingsController', ['$router', SettingsController]); 5 | 6 | function SettingsController($router) { 7 | this.heading = 'Settings'; 8 | this.router = $router; 9 | 10 | $router.config([ 11 | { path: '/', redirectTo: '/welcome' }, 12 | { path: '/welcome', component: 'welcome', title:'Welcome' }, 13 | { path: '/flickr', component: 'flickr' } 14 | ]); 15 | } 16 | -------------------------------------------------------------------------------- /scripts/copy_files.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs-extra'); 2 | var path = require('path'); 3 | 4 | var PROJECT_ROOT = path.resolve(__dirname, '../'); 5 | 6 | var ROUTER_LIB_FOLDER = PROJECT_ROOT + '/node_modules/angular2/src/router'; 7 | var SRC_FOLDER = PROJECT_ROOT + '/src'; 8 | 9 | var TMP_FOLDER = PROJECT_ROOT + '/tmp'; 10 | var ROUTER_TMP_FOLDER = TMP_FOLDER + '/router'; 11 | 12 | console.log('Copying files'); 13 | fs.emptyDirSync(TMP_FOLDER); 14 | fs.copySync(ROUTER_LIB_FOLDER, ROUTER_TMP_FOLDER); 15 | fs.copySync(SRC_FOLDER, TMP_FOLDER); 16 | -------------------------------------------------------------------------------- /examples/outdated/hello/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('example', [ 4 | 'example.flickr', 5 | 'example.settings', 6 | 'example.welcome', 7 | 'ngNewRouter' 8 | ]). 9 | controller('AppController', ['$router', AppController]); 10 | 11 | function AppController($router) { 12 | $router.config([ 13 | { path: '/', redirectTo: '/welcome' }, 14 | { path: '/welcome', component: 'welcome' }, 15 | { path: '/flickr', component: 'flickr' }, 16 | { path: '/settings', component: 'settings' } 17 | ]); 18 | } 19 | -------------------------------------------------------------------------------- /src/router/lifecycle/route_lifecycle_reflector.js: -------------------------------------------------------------------------------- 1 | var lang_1 = require('angular2/src/facade/lang'); 2 | 3 | function hasLifecycleHook(e, type) { 4 | if (!(type instanceof lang_1.Type)) 5 | return false; 6 | return e.name in type.prototype; 7 | } 8 | exports.hasLifecycleHook = hasLifecycleHook; 9 | 10 | function getCanActivateHook(directiveName) { 11 | // This is going to be monkey patched from inside 12 | // the routerFactory closure, because the implementation 13 | // will need access to $injector 14 | } 15 | 16 | exports.getCanActivateHook = getCanActivateHook; -------------------------------------------------------------------------------- /karma.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (config) { 4 | var options = { 5 | frameworks: ['jasmine'], 6 | 7 | files: [ 8 | 'node_modules/es6-shim/es6-shim.js', 9 | 'node_modules/angular/angular.js', 10 | 'node_modules/angular-animate/angular-animate.js', 11 | 'node_modules/angular-mocks/angular-mocks.js', 12 | 13 | 'dist/angular-component-router.js', 14 | 'dist/ng_route_shim.js', 15 | 16 | 'test/*.es5.js', 17 | 'test/**/*_spec.js' 18 | ], 19 | 20 | browsers: ['Chrome'] 21 | }; 22 | 23 | config.set(options); 24 | }; 25 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('phoneKitten', [ 4 | 'ngNewRouter', 5 | 'ngAnimate', 6 | 7 | 'phoneKitten.phoneDetail', 8 | 'phoneKitten.phoneList', 9 | 10 | 'phoneKitten.filters', 11 | 'phoneKitten.services' 12 | ]). 13 | controller('AppController', ['$router', AppController]); 14 | 15 | function AppController($router) { 16 | $router.config([ 17 | { path: '/' , redirectTo: '/phones' }, 18 | { path: '/phones' , component: 'phoneList' }, 19 | { path: '/phones/:phoneId' , component: 'phoneDetail' } 20 | ]); 21 | } 22 | -------------------------------------------------------------------------------- /examples/heroes/app/crisis-center/crisis-overview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{country}} 4 | 5 |
    6 |
  • 9 | {{crisis.id}} {{crisis.name}} 10 |
  • 11 |
12 |
13 |
14 |
-------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/app.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp', [ 2 | 'ngNewRouter', 3 | 'myApp.index', 4 | 'myApp.editPost', 5 | 'myApp.saveModal' 6 | ]) 7 | .controller('AppController', ['$router', AppController]) 8 | .factory('posts', postsFactory); 9 | 10 | 11 | function AppController($router) { 12 | $router.config([ 13 | { path: '/', component: 'index' }, 14 | { path: '/post/:id', component: 'editPost' }, 15 | ]); 16 | } 17 | 18 | function postsFactory() { 19 | return { 20 | '1': { title: 'First Post', content: 'I wrote this first.' }, 21 | '2': { title: 'Second Post', content: 'I wrote this second.' } 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/components/phone-detail/phone-detail.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('phoneKitten.phoneDetail', []). 4 | controller('PhoneDetailController', ['$routeParams', 'Phone', PhoneDetailController]); 5 | 6 | function PhoneDetailController($routeParams, Phone) { 7 | var self = this; 8 | this.phone = Phone.get({phoneId: $routeParams.phoneId}, function(phone) { 9 | self.setImage(phone.images[0]); 10 | }); 11 | } 12 | 13 | PhoneDetailController.prototype.canActivate = function() { 14 | return this.phone.$promise; 15 | }; 16 | 17 | PhoneDetailController.prototype.setImage = function(imageUrl) { 18 | this.mainImageUrl = imageUrl; 19 | }; 20 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/edit-post/edit-post.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.editPost', []). 2 | controller('EditPostController', ['$routeParams', 'posts', 'saveModal', EditPostController]); 3 | 4 | function EditPostController($routeParams, posts, saveModal) { 5 | this.saveModal = saveModal; 6 | this.post = posts[$routeParams.id]; 7 | this.newContent = this.post.content; 8 | } 9 | 10 | EditPostController.prototype.canDeactivate = function () { 11 | if (this.newContent === this.post.content) { 12 | return true; 13 | } 14 | return this.saveModal.getResponse(); 15 | }; 16 | 17 | EditPostController.prototype.save = function () { 18 | this.post.content = this.newContent; 19 | }; 20 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/save-modal/save-modal.css: -------------------------------------------------------------------------------- 1 | .modal { 2 | position: fixed; 3 | top: 0; 4 | left: 0; 5 | right: 0; 6 | bottom: 0; 7 | z-index: 999; 8 | overflow: hidden; 9 | background-color: rgba(0, 0, 0, 0.75); 10 | } 11 | 12 | .modal-inner, .modal--show .modal-inner { 13 | position: absolute; 14 | top: 60px; 15 | left: 50%; 16 | z-index: 20; 17 | margin-left: -200px; 18 | padding: 1em; 19 | width: 400px; 20 | 21 | border-radius: 2px; 22 | background: #FFF; 23 | -webkit-box-shadow: 0 0 30px rgba(0, 0, 0, 0.6); 24 | box-shadow: 0 0 30px rgba(0, 0, 0, 0.6); 25 | max-width: 100%; 26 | overflow-x: hidden; 27 | -webkit-overflow-scrolling: touch; 28 | } 29 | -------------------------------------------------------------------------------- /examples/outdated/sibbling-routes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 |
15 |
16 |
17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/heroes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Router Sample 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

Component Router

20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/outdated/wizard/app.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp', [ 2 | 'ngNewRouter', 3 | 'myApp.intro', 4 | 'myApp.one', 5 | 'myApp.two', 6 | 'myApp.three', 7 | 'myApp.end' 8 | ]). 9 | controller('AppController', ['$router', AppController]). 10 | factory('answers', answersFactory); 11 | 12 | function AppController($router) { 13 | $router.config([ 14 | { path: '/', component: 'intro' }, 15 | { path: '/one', component: 'one' }, 16 | { path: '/two', component: 'two' }, 17 | { path: '/three', component: 'three' }, 18 | { path: '/end', component: 'end' } 19 | ]); 20 | } 21 | 22 | 23 | function answersFactory() { 24 | return { 25 | name: null, 26 | quest: null, 27 | favoriteColor: null 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /examples/heroes/app/app.js: -------------------------------------------------------------------------------- 1 | angular.module('app', ['ngComponentRouter', 'dialog', 'heroes', 'crisis-center']) 2 | 3 | .config(function($locationProvider) { 4 | $locationProvider.html5Mode(true); 5 | }) 6 | 7 | .value('$routerRootComponent', 'app') 8 | 9 | .component('app', { 10 | template: 11 | '\n' + 15 | '\n', 16 | $routeConfig: [ 17 | {path: '/crisis-center/...', name: 'CrisisCenter', component: 'crisisCenter', useAsDefault: true}, 18 | {path: '/heroes/...', name: 'Heroes', component: 'heroes'}, 19 | // {path: '/disaster', name: 'Asteroid', redirectTo: ['CrisisCenter', 'CrisisDetail', {id:3}]} 20 | ] 21 | }); -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /examples/outdated/hello/components/flickr/flickr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.module('example.flickr', []). 4 | controller('FlickrController', ['$http', FlickrController]); 5 | 6 | var URL = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=angularjs&tagmode=any&format=json'; 7 | 8 | function FlickrController($http) { 9 | this.heading = 'Flickr'; 10 | this.images = []; 11 | this.http = $http; 12 | 13 | this.activate(); 14 | } 15 | 16 | FlickrController.prototype.activate = function() { 17 | var self = this; 18 | 19 | // hack 20 | window.jsonFlickrFeed = function(result) { 21 | self.images = result.items; 22 | }; 23 | 24 | this.http.jsonp(URL); 25 | }; 26 | 27 | FlickrController.prototype.canDeactivate = function() { 28 | return confirm('Are you sure you want to leave?'); 29 | }; 30 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/components/save-modal/save-modal.js: -------------------------------------------------------------------------------- 1 | angular.module('myApp.saveModal', ['btford.modal']) 2 | .factory('saveModal', ['btfModal', '$q', saveModalFactory]); 3 | 4 | function saveModalFactory (btfModal, $q) { 5 | var modal = btfModal({ 6 | templateUrl: './components/save-modal/save-modal.html', 7 | controller: ['resolve', 'reject', ModalController], 8 | controllerAs: 'modal' 9 | }); 10 | 11 | function ModalController(resolve, reject) { 12 | this.confirm = function () { 13 | resolve(true); 14 | modal.deactivate(); 15 | }; 16 | this.cancel = function () { 17 | reject(); 18 | modal.deactivate(); 19 | }; 20 | } 21 | 22 | return { 23 | getResponse: function () { 24 | return $q(function (resolve, reject) { 25 | modal.activate({ 26 | resolve: resolve, 27 | reject: reject 28 | }); 29 | }); 30 | } 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/components/phone-list/phone-list.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | Search: 7 | Sort by: 8 | 12 | 13 |
14 |
15 | 16 | 17 | 25 | 26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /examples/outdated/wizard/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | Wizard 13 | 14 | 15 | 16 |

hello

17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-new-router", 3 | "version": "0.5.3", 4 | "description": "The Component Router for Angular 1", 5 | "homepage": "https://github.com/angular/router", 6 | "main": "index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "git://github.com/angular/router.git" 10 | }, 11 | "bugs": { 12 | "url": "https://github.com/angular/router/issues" 13 | }, 14 | "dependencies": { 15 | "angular2": "^2.0.0-beta.8" 16 | }, 17 | "devDependencies": { 18 | "angular": "1.5.x", 19 | "angular-animate": "^1.5.3", 20 | "angular-mocks": "^1.5.3", 21 | "es6-shim": "^0.35.0", 22 | "fs-extra": "^0.26.5", 23 | "jasmine-core": "^2.4.1", 24 | "karma": "^0.13.22", 25 | "karma-chrome-launcher": "^0.2.3", 26 | "karma-jasmine": "^0.3.8", 27 | "lite-server": "^2.0.1", 28 | "webpack": "^1.12.14" 29 | }, 30 | "scripts": { 31 | "clean": "rm -rf tmp && rm -rf dist", 32 | "start": "node scripts/copy_files.js && webpack" 33 | }, 34 | "author": "Angular Core Team", 35 | "license": "MIT" 36 | } 37 | -------------------------------------------------------------------------------- /examples/heroes/app/crisis-center/crisis-overview.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('crisis-center/crisis-overview', []) 4 | 5 | .component('crisisOverview', { 6 | templateUrl: 'app/crisis-center/crisis-overview.html', 7 | bindings: { $router: '<' }, 8 | controller: CrisisOverviewComponent, 9 | $canActivate: function($nextInstruction, $prevInstruction) { 10 | console.log('$canActivate', arguments); 11 | } 12 | }); 13 | 14 | 15 | function CrisisOverviewComponent(crisisService) { 16 | var ctrl = this; 17 | 18 | this.countries = ['USA', 'UK']; 19 | 20 | this.$routerOnActivate = function(next) { 21 | console.log('$routerOnActivate', this, arguments); 22 | // Load up the crises for this view 23 | crisisService.getCrises().then(function(crises) { 24 | ctrl.crises = crises; 25 | ctrl.currentCrisis = next.params.crisis; 26 | }); 27 | 28 | ctrl.selectedCountry = next.params.country; 29 | }; 30 | 31 | this.editCrisis = function(crisis) { 32 | this.$router.navigate(['CrisisDetail', { country: crisis.country, crisis: crisis.id }]); 33 | }; 34 | }; -------------------------------------------------------------------------------- /shims/angular2/src/facade/async.js: -------------------------------------------------------------------------------- 1 | var PromiseWrapper = { 2 | resolve: function (reason) { 3 | return PromiseWrapper.$q.when(reason); 4 | }, 5 | 6 | reject: function (reason) { 7 | return PromiseWrapper.$q.reject(reason); 8 | }, 9 | 10 | catchError: function (promise, fn) { 11 | return promise.then(null, fn); 12 | }, 13 | all: function (promises) { 14 | return PromiseWrapper.$q.all(promises); 15 | } 16 | }; 17 | 18 | function EventEmitter() { 19 | //TODO: implement? 20 | // I think it's too heavy to ask 1.x users to bring in Rx for the router... 21 | } 22 | 23 | var ObservableWrapper = { 24 | callNext: function(ob, val) { 25 | ob.fn(val); 26 | }, 27 | callEmit: function(ob, val) { 28 | ob.fn(val); 29 | }, 30 | callError: function(ob, val) { 31 | if (ob.errorFn) ob.errorFn(val); 32 | }, 33 | 34 | subscribe: function(ob, fn, errorFn) { 35 | ob.fn = fn; 36 | ob.errorFn = errorFn; 37 | } 38 | }; 39 | 40 | module.exports = { 41 | PromiseWrapper: PromiseWrapper, 42 | EventEmitter: EventEmitter, 43 | ObservableWrapper: ObservableWrapper 44 | }; -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/js/animations.js: -------------------------------------------------------------------------------- 1 | angular.module('phoneKitten.animation', ['ngAnimate']). 2 | animation('.phone', function() { 3 | 4 | var animateUp = function(element, className, done) { 5 | if(className != 'active') { 6 | return; 7 | } 8 | element.css({ 9 | position: 'absolute', 10 | top: 500, 11 | left: 0, 12 | display: 'block' 13 | }); 14 | 15 | jQuery(element).animate({ 16 | top: 0 17 | }, done); 18 | 19 | return function(cancel) { 20 | if(cancel) { 21 | element.stop(); 22 | } 23 | }; 24 | } 25 | 26 | var animateDown = function(element, className, done) { 27 | if(className != 'active') { 28 | return; 29 | } 30 | element.css({ 31 | position: 'absolute', 32 | left: 0, 33 | top: 0 34 | }); 35 | 36 | jQuery(element).animate({ 37 | top: -500 38 | }, done); 39 | 40 | return function(cancel) { 41 | if(cancel) { 42 | element.stop(); 43 | } 44 | }; 45 | } 46 | 47 | return { 48 | addClass: animateUp, 49 | removeClass: animateDown 50 | }; 51 | }); 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014-2016 Google, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Google Phone Gallery 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/heroes/styles.css: -------------------------------------------------------------------------------- 1 | h1 {color: #369; font-family: Arial, Helvetica, sans-serif; font-size: 250%;} 2 | h2 { color: #369; font-family: Arial, Helvetica, sans-serif; } 3 | h3 { color: #444; font-weight: lighter; } 4 | body { margin: 2em; } 5 | body, input[text], button { color: #888; font-family: Cambria, Georgia; } 6 | button {padding: 0.2em; font-size: 14px} 7 | 8 | ul {list-style-type: none; margin-left: 1em; padding: 0; width: 20em;} 9 | 10 | li { cursor: pointer; position: relative; left: 0; transition: all 0.2s ease; } 11 | li:hover {color: #369; background-color: #EEE; left: .2em;} 12 | 13 | /* route-link anchor tags */ 14 | a {padding: 5px; text-decoration: none; font-family: Arial, Helvetica, sans-serif; } 15 | a:visited, a:link {color: #444;} 16 | a:hover {color: white; background-color: #1171a3; } 17 | a.router-link-active {color: white; background-color: #52b9e9; } 18 | 19 | .selected { background-color: #EEE; color: #369; } 20 | 21 | .badge { 22 | font-size: small; 23 | color: white; 24 | padding: 0.1em 0.7em; 25 | background-color: #369; 26 | line-height: 1em; 27 | position: relative; 28 | left: -1px; 29 | top: -1px; 30 | } 31 | 32 | crisis-detail input { 33 | width: 20em; 34 | } -------------------------------------------------------------------------------- /src/router/location/location.js: -------------------------------------------------------------------------------- 1 | // This Location class is a direct replacement for the Location in the Angular 2 Router 2 | // This version accepts the angular $location services as a dependency 3 | function Location($location, $rootScope){ 4 | var onNextHandlers = []; 5 | 6 | this.subscribe = function (onNext, onThrow, onReturn) { 7 | onNextHandlers.push(onNext); 8 | return { 9 | dispose: function() { 10 | var index = onNextHandlers.indexOf(onNext); 11 | onNextHandlers.splice(index, 1); 12 | } 13 | }; 14 | }; 15 | 16 | this.path = function () { 17 | return $location.url(); 18 | }; 19 | 20 | this.go = function (path, query) { 21 | return $location.url(path + query); 22 | }; 23 | 24 | this.prepareExternalUrl = function(url) { 25 | if (url.length > 0 && !url.startsWith('/')) { 26 | url = '/' + url; 27 | } 28 | if(!$location.$$html5) { 29 | return '#' + url; 30 | } else { 31 | return '.' + url; 32 | } 33 | }; 34 | 35 | $rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl, newState, oldState) { 36 | if (newUrl !== oldUrl) { 37 | onNextHandlers.forEach(function(handler) { handler({url: $location.url()}); }); 38 | } 39 | }); 40 | } 41 | 42 | exports.Location = Location; -------------------------------------------------------------------------------- /src/router/route_registry_factory.js: -------------------------------------------------------------------------------- 1 | var RouteRegistry = require('./route_registry').RouteRegistry; 2 | var lang = require('angular2/src/facade/lang'); 3 | var isString = lang.isString; 4 | var isPresent = lang.isPresent; 5 | 6 | module.exports = function routeRegistryFactory(getAnnotation, rootComponent, $injector) { 7 | 8 | // Create a monkey patched version of the registry 9 | var routeRegistry = new RouteRegistry(rootComponent); 10 | 11 | routeRegistry.configFromComponent = function (component) { 12 | var that = this; 13 | if (isString(component)) { 14 | // Don't read the annotations component a type more than once – 15 | // this prevents an infinite loop if a component routes recursively. 16 | if (this._rules.has(component)) { 17 | return; 18 | } 19 | var $routeConfig = getAnnotation(component, '$routeConfig'); 20 | if (angular.isArray($routeConfig)) { 21 | $routeConfig.forEach(function (config) { 22 | var loader = config.loader; 23 | if (isPresent(loader)) { 24 | config = angular.extend({}, config, { loader: function() { return $injector.invoke(loader); } }); 25 | } 26 | that.config(component, config); 27 | }); 28 | } 29 | } 30 | }; 31 | 32 | return routeRegistry; 33 | }; -------------------------------------------------------------------------------- /examples/heroes/app/crisis-center/crisis-center.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('crisis-center', [ 4 | 'crisis-center/crisis-overview', 5 | 'crisis-center/crisis-detail' 6 | ]) 7 | 8 | .service('crisisService', CrisisService) 9 | 10 | .component('crisisCenter', { 11 | template: '

Crisis Center

', 12 | $routeConfig: [ 13 | {path:'/', name: 'CrisisList', component: 'crisisOverview', useAsDefault: true}, 14 | {path:'/:country/:crisis', name: 'CrisisDetail', component: 'crisisDetail'} 15 | ] 16 | }) 17 | 18 | 19 | function CrisisService($q) { 20 | var crisesPromise = $q.when([ 21 | {id: 1, name: 'Princess Held Captive', country: 'UK'}, 22 | {id: 2, name: 'Dragon Burning Cities', country: 'USA'}, 23 | {id: 3, name: 'Giant Asteroid Heading For Earth', country: 'UK'}, 24 | {id: 4, name: 'Release Deadline Looms', country: 'USA'} 25 | ]); 26 | 27 | this.getCrises = function() { 28 | return crisesPromise; 29 | }; 30 | 31 | this.getCrisis = function(id) { 32 | return crisesPromise.then(function(crises) { 33 | for(var i=0; i 2 | 3 | 4 | 5 | 6 | 7 | Routing 8 | 9 | 10 | 24 | 25 |
26 | 27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /examples/outdated/hello/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 11 | 12 | Routing 13 | 14 | 15 | 16 | 31 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /examples/heroes/app/crisis-center/crisis-detail.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('crisis-center/crisis-detail', []) 4 | 5 | .component('crisisDetail', { 6 | templateUrl: 'app/crisis-center/crisisDetail.html', 7 | bindings: { $router: '<' }, 8 | controller: CrisisDetailComponent 9 | }); 10 | 11 | function CrisisDetailComponent(crisisService, dialogService) { 12 | var ctrl = this; 13 | this.$routerOnActivate = function(next) { 14 | // Get the crisis identified by the route parameter 15 | var id = next.params.id; 16 | crisisService.getCrisis(id).then(function(crisis) { 17 | if (crisis) { 18 | ctrl.editName = crisis.name; 19 | ctrl.crisis = crisis; 20 | } else { // id not found 21 | ctrl.gotoCrises(); 22 | } 23 | }); 24 | }; 25 | 26 | this.$routerCanDeactivate = function() { 27 | // Allow synchronous navigation (`true`) if no crisis or the crisis is unchanged. 28 | if (!this.crisis || this.crisis.name === this.editName) { 29 | return true; 30 | } 31 | // Otherwise ask the user with the dialog service and return its 32 | // promise which resolves to true or false when the user decides 33 | return dialogService.confirm('Discard changes?'); 34 | }; 35 | 36 | this.cancel = function() { 37 | ctrl.editName = ctrl.crisis.name; 38 | ctrl.gotoCrises(); 39 | }; 40 | 41 | this.save = function() { 42 | ctrl.crisis.name = ctrl.editName; 43 | ctrl.gotoCrises(); 44 | }; 45 | 46 | this.gotoCrises = function() { 47 | var crisisId = ctrl.crisis && ctrl.crisis.id; 48 | // Pass along the hero id if available 49 | // so that the CrisisListComponent can select that hero. 50 | this.$router.navigate(['CrisisList', {id: crisisId}]); 51 | }; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/css/app.css: -------------------------------------------------------------------------------- 1 | /* app css stylesheet */ 2 | 3 | body { 4 | padding-top: 20px; 5 | } 6 | 7 | 8 | .phone-images { 9 | background-color: white; 10 | width: 450px; 11 | height: 450px; 12 | overflow: hidden; 13 | position: relative; 14 | float: left; 15 | } 16 | 17 | .phones { 18 | list-style: none; 19 | } 20 | 21 | .thumb { 22 | float: left; 23 | margin: -0.5em 1em 1.5em 0; 24 | padding-bottom: 1em; 25 | height: 100px; 26 | width: 100px; 27 | } 28 | 29 | .phones li { 30 | clear: both; 31 | height: 115px; 32 | padding-top: 15px; 33 | } 34 | 35 | /** Detail View **/ 36 | img.phone { 37 | float: left; 38 | margin-right: 3em; 39 | margin-bottom: 2em; 40 | background-color: white; 41 | padding: 2em; 42 | height: 400px; 43 | width: 400px; 44 | display: none; 45 | } 46 | 47 | img.phone.active { 48 | display: block; 49 | } 50 | 51 | 52 | ul.phone-thumbs { 53 | margin: 0; 54 | list-style: none; 55 | } 56 | 57 | ul.phone-thumbs li { 58 | border: 1px solid black; 59 | display: inline-block; 60 | margin: 1em; 61 | background-color: white; 62 | } 63 | 64 | ul.phone-thumbs img { 65 | height: 100px; 66 | width: 100px; 67 | padding: 1em; 68 | } 69 | 70 | ul.phone-thumbs img:hover { 71 | cursor: pointer; 72 | } 73 | 74 | 75 | ul.specs { 76 | clear: both; 77 | margin: 0; 78 | padding: 0; 79 | list-style: none; 80 | } 81 | 82 | ul.specs > li{ 83 | display: inline-block; 84 | width: 200px; 85 | vertical-align: top; 86 | } 87 | 88 | ul.specs > li > span{ 89 | font-weight: bold; 90 | font-size: 1.2em; 91 | } 92 | 93 | ul.specs dt { 94 | font-weight: bold; 95 | } 96 | 97 | h1 { 98 | border-bottom: 1px solid gray; 99 | } 100 | -------------------------------------------------------------------------------- /test/integration/animation_spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | fdescribe('ngOutlet animations', function () { 4 | 5 | function createTestModule() { 6 | angular.module('testMod', ['ngAnimate', 'ngAnimateMock', 'ngComponentRouter']) 7 | .component('userCmp', { 8 | template: '
hello {{$ctrl.$routeParams.name}}
', 9 | controller: function() { 10 | this.$routerOnActivate = function(next) { 11 | this.$routeParams = next.params; 12 | }; 13 | } 14 | }); 15 | module('testMod'); 16 | } 17 | 18 | it('should work in a simple case', function () { 19 | var item; 20 | 21 | createTestModule(); 22 | 23 | inject(function($compile, $rootScope, $animate, $rootRouter) { 24 | var elt = $compile('
')($rootScope); 25 | 26 | $rootRouter.config([ 27 | { path: '/user/:name', component: 'userCmp' } 28 | ]); 29 | 30 | $rootRouter.navigateByUrl('/user/brian'); 31 | $rootScope.$digest(); 32 | expect(elt.text()).toBe('hello brian'); 33 | 34 | // "user" component enters 35 | item = $animate.queue.shift(); 36 | expect(item.event).toBe('enter'); 37 | 38 | // navigate to pete 39 | $rootRouter.navigateByUrl('/user/pete'); 40 | $rootScope.$digest(); 41 | expect(elt.text()).toBe('hello pete'); 42 | 43 | // "user pete" component enters 44 | item = $animate.queue.shift(); 45 | expect(item.event).toBe('enter'); 46 | expect(item.element.text()).toBe('hello pete'); 47 | 48 | // "user brian" component leaves 49 | item = $animate.queue.shift(); 50 | expect(item.event).toBe('leave'); 51 | expect(item.element.text()).toBe('hello brian'); 52 | 53 | expect($animate.queue).toEqual([]); 54 | }); 55 | }); 56 | }); 57 | -------------------------------------------------------------------------------- /test/util.es5.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Helpers to keep tests DRY 3 | */ 4 | 5 | function componentTemplatePath(name) { 6 | return './components/' + dashCase(name) + '/' + dashCase(name) + '.html'; 7 | } 8 | 9 | function componentControllerName(name) { 10 | return name[0].toUpperCase() + name.substr(1) + 'Controller'; 11 | } 12 | 13 | function dashCase(str) { 14 | return str.replace(/([A-Z])/g, function ($1) { 15 | return '-' + $1.toLowerCase(); 16 | }); 17 | } 18 | 19 | 20 | function provideHelpers(fn, preInject) { 21 | return function () { 22 | var elt, 23 | $compile, 24 | $rootScope, 25 | $rootRouter, 26 | $templateCache, 27 | $controllerProvider; 28 | 29 | module('ng'); 30 | module('ngNewRouter'); 31 | module(function(_$controllerProvider_) { 32 | $controllerProvider = _$controllerProvider_; 33 | }); 34 | 35 | inject(function(_$compile_, _$rootScope_, _$rootRouter_, _$templateCache_) { 36 | $compile = _$compile_; 37 | $rootScope = _$rootScope_; 38 | $rootRouter = _$rootRouter_; 39 | $templateCache = _$templateCache_; 40 | }); 41 | 42 | function registerComponent(name, template, config) { 43 | if (!template) { 44 | template = ''; 45 | } 46 | var ctrl; 47 | if (!config) { 48 | ctrl = function () {}; 49 | } else if (angular.isArray(config)) { 50 | ctrl = function () {}; 51 | ctrl.$routeConfig = config; 52 | } else if (typeof config === 'function') { 53 | ctrl = config; 54 | } else { 55 | ctrl = function () {}; 56 | ctrl.prototype = config; 57 | } 58 | $controllerProvider.register(componentControllerName(name), ctrl); 59 | put(name, template); 60 | } 61 | 62 | 63 | function put (name, template) { 64 | $templateCache.put(componentTemplatePath(name), [200, template, {}]); 65 | } 66 | 67 | fn({ 68 | $rootRouter: $rootRouter, 69 | put: put 70 | }) 71 | } 72 | } -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/css/animations.css: -------------------------------------------------------------------------------- 1 | /* 2 | * animations css stylesheet 3 | */ 4 | 5 | /* animate ngRepeat in phone listing */ 6 | 7 | /*.phone-listing.ng-enter, 8 | .phone-listing.ng-leave, 9 | .phone-listing.ng-move { 10 | -webkit-transition: 0.5s linear all; 11 | -moz-transition: 0.5s linear all; 12 | -o-transition: 0.5s linear all; 13 | transition: 0.5s linear all; 14 | } 15 | 16 | .phone-listing.ng-enter, 17 | .phone-listing.ng-move { 18 | opacity: 0; 19 | height: 0; 20 | overflow: hidden; 21 | } 22 | 23 | .phone-listing.ng-move.ng-move-active, 24 | .phone-listing.ng-enter.ng-enter-active { 25 | opacity: 1; 26 | height: 120px; 27 | } 28 | 29 | .phone-listing.ng-leave { 30 | opacity: 1; 31 | overflow: hidden; 32 | } 33 | 34 | .phone-listing.ng-leave.ng-leave-active { 35 | opacity: 0; 36 | height: 0; 37 | padding-top: 0; 38 | padding-bottom: 0; 39 | }*/ 40 | 41 | /* cross fading between routes with ngView */ 42 | 43 | .view-container { 44 | position: relative; 45 | } 46 | 47 | .view-frame .ng-enter, 48 | .view-frame .ng-leave { 49 | background: white; 50 | position: absolute; 51 | top: 0; 52 | left: 0; 53 | right: 0; 54 | } 55 | 56 | .view-frame .ng-enter { 57 | -webkit-animation: 0.5s fade-in; 58 | -moz-animation: 0.5s fade-in; 59 | -o-animation: 0.5s fade-in; 60 | animation: 0.5s fade-in; 61 | z-index: 100; 62 | } 63 | 64 | .view-frame .ng-leave { 65 | -webkit-animation: 0.5s fade-out; 66 | -moz-animation: 0.5s fade-out; 67 | -o-animation: 0.5s fade-out; 68 | animation: 0.5s fade-out; 69 | z-index: 99; 70 | } 71 | 72 | @keyframes fade-in { 73 | from { opacity: 0; } 74 | to { opacity: 1; } 75 | } 76 | @-moz-keyframes fade-in { 77 | from { opacity: 0; } 78 | to { opacity: 1; } 79 | } 80 | @-webkit-keyframes fade-in { 81 | from { opacity: 0; } 82 | to { opacity: 1; } 83 | } 84 | 85 | @keyframes fade-out { 86 | from { opacity: 1; } 87 | to { opacity: 0; } 88 | } 89 | @-moz-keyframes fade-out { 90 | from { opacity: 1; } 91 | to { opacity: 0; } 92 | } 93 | @-webkit-keyframes fade-out { 94 | from { opacity: 1; } 95 | to { opacity: 0; } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/sanyo-zio.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Trackball Navigation Control", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "" 6 | }, 7 | "availability": [ 8 | "Sprint" 9 | ], 10 | "battery": { 11 | "standbyTime": "", 12 | "talkTime": "4 hours", 13 | "type": "Lithium Ion (Li-Ion) (1130 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Video" 18 | ], 19 | "primary": "3.2 megapixels" 20 | }, 21 | "connectivity": { 22 | "bluetooth": "Bluetooth 2.1", 23 | "cell": "CDMA2000 1xEV-DO Rev.A", 24 | "gps": true, 25 | "infrared": false, 26 | "wifi": "802.11 b/g" 27 | }, 28 | "description": "Zio uses CDMA2000 1xEV-DO rev. A and Wi-Fi technologies and features a 3.5-inch WVGA touch-screen display as a backdrop for a fully customizable mobile multimedia experience. Along with the touch-screen, a trackball helps users navigate features such as the 3.2 MP camera with video record/playback, media player and full HTML Web browser. Zio supports up to 32GB through its external microSD memory slot.", 29 | "display": { 30 | "screenResolution": "WVGA (800 x 480)", 31 | "screenSize": "3.5 inches", 32 | "touchScreen": true 33 | }, 34 | "hardware": { 35 | "accelerometer": true, 36 | "audioJack": "3.5mm", 37 | "cpu": "600MHz Qualcomm MSM7627", 38 | "fmRadio": false, 39 | "physicalKeyboard": false, 40 | "usb": "USB 2.0" 41 | }, 42 | "id": "sanyo-zio", 43 | "images": [ 44 | "img/phones/sanyo-zio.0.jpg", 45 | "img/phones/sanyo-zio.1.jpg", 46 | "img/phones/sanyo-zio.2.jpg" 47 | ], 48 | "name": "SANYO ZIO", 49 | "sizeAndWeight": { 50 | "dimensions": [ 51 | "58.6 mm (w)", 52 | "116.0 mm (h)", 53 | "12.2 mm (d)" 54 | ], 55 | "weight": "105.0 grams" 56 | }, 57 | "storage": { 58 | "flash": "130MB", 59 | "ram": "256MB" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/motorola-xoom.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Front-facing camera. Sensors: proximity, ambient light, barometer, gyroscope.", 3 | "android": { 4 | "os": "Android 3.0", 5 | "ui": "Android" 6 | }, 7 | "availability": [ 8 | "Verizon" 9 | ], 10 | "battery": { 11 | "standbyTime": "336 hours", 12 | "talkTime": "24 hours", 13 | "type": "Other (3250 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "CDMA 800 /1900 LTE 700, Rx diversity in all bands", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 a/b/g/n" 28 | }, 29 | "description": "MOTOROLA XOOM has a super-powerful dual-core processor and Android\u2122 3.0 (Honeycomb) \u2014 the Android platform designed specifically for tablets. With its 10.1-inch HD widescreen display, you\u2019ll enjoy HD video in a thin, light, powerful and upgradeable tablet.", 30 | "display": { 31 | "screenResolution": "WXGA (1200 x 800)", 32 | "screenSize": "10.1 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "1 GHz Dual Core Tegra 2", 39 | "fmRadio": false, 40 | "physicalKeyboard": false, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "motorola-xoom", 44 | "images": [ 45 | "img/phones/motorola-xoom.0.jpg", 46 | "img/phones/motorola-xoom.1.jpg", 47 | "img/phones/motorola-xoom.2.jpg" 48 | ], 49 | "name": "MOTOROLA XOOM\u2122", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "249.0 mm (w)", 53 | "168.0 mm (h)", 54 | "12.7 mm (d)" 55 | ], 56 | "weight": "726.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "32000MB", 60 | "ram": "1000MB" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /shims/angular2/src/facade/lang.js: -------------------------------------------------------------------------------- 1 | exports.Math = Math; 2 | 3 | exports.CONST = function CONST() { 4 | return (function(target) { 5 | return target; 6 | }); 7 | }; 8 | 9 | exports.CONST_EXPR = function CONST_EXPR(expr) { 10 | return expr; 11 | }; 12 | 13 | exports.isPresent = function isPresent (x) { 14 | return !!x; 15 | }; 16 | 17 | exports.isBlank = function isBlank (x) { 18 | return !x; 19 | }; 20 | 21 | exports.isString = function isString(obj) { 22 | return typeof obj === 'string'; 23 | }; 24 | 25 | exports.isType = function isType (x) { 26 | return typeof x === 'function'; 27 | }; 28 | 29 | exports.isStringMap = function isStringMap(obj) { 30 | return typeof obj === 'object' && obj !== null; 31 | }; 32 | 33 | exports.isArray = function isArray(obj) { 34 | return Array.isArray(obj); 35 | }; 36 | 37 | exports.getTypeNameForDebugging = function getTypeNameForDebugging (fn) { 38 | return fn.name || 'Root'; 39 | }; 40 | 41 | exports.RegExpWrapper = { 42 | create: function(regExpStr, flags) { 43 | flags = flags ? flags.replace(/g/g, '') : ''; 44 | return new RegExp(regExpStr, flags + 'g'); 45 | }, 46 | firstMatch: function(regExp, input) { 47 | regExp.lastIndex = 0; 48 | return regExp.exec(input); 49 | }, 50 | matcher: function (regExp, input) { 51 | regExp.lastIndex = 0; 52 | return { re: regExp, input: input }; 53 | } 54 | }; 55 | 56 | 57 | 58 | exports.StringWrapper = { 59 | charCodeAt: function(s, i) { 60 | return s.charCodeAt(i); 61 | }, 62 | 63 | equals: function (s1, s2) { 64 | return s1 === s2; 65 | }, 66 | 67 | split: function(s, re) { 68 | return s.split(re); 69 | }, 70 | 71 | replaceAll: function(s, from, replace) { 72 | return s.replace(from, replace); 73 | }, 74 | 75 | replaceAllMapped: function(s, from, cb) { 76 | return s.replace(from, function(matches) { 77 | // Remove offset & string from the result array 78 | matches.splice(-2, 2); 79 | // The callback receives match, p1, ..., pn 80 | return cb.apply(null, matches); 81 | }); 82 | }, 83 | 84 | contains: function(s, substr) { 85 | return s.indexOf(substr) != -1; 86 | } 87 | 88 | }; -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/motorola-atrix-4g.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "MOTOBLUR" 6 | }, 7 | "availability": [ 8 | "AT&T" 9 | ], 10 | "battery": { 11 | "standbyTime": "400 hours", 12 | "talkTime": "5 hours", 13 | "type": "Lithium Ion (Li-Ion) (1930 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "" 18 | ], 19 | "primary": "" 20 | }, 21 | "connectivity": { 22 | "bluetooth": "Bluetooth 2.1", 23 | "cell": "WCDMA 850/1900/2100, GSM 850/900/1800/1900, HSDPA 14Mbps (Category 10) Edge Class 12, GPRS Class 12, eCompass, AGPS", 24 | "gps": true, 25 | "infrared": false, 26 | "wifi": "802.11 a/b/g/n" 27 | }, 28 | "description": "MOTOROLA ATRIX 4G gives you dual-core processing power and the revolutionary webtop application. With webtop and a compatible Motorola docking station, sold separately, you can surf the Internet with a full Firefox browser, create and edit docs, or access multimedia on a large screen almost anywhere.", 29 | "display": { 30 | "screenResolution": "QHD (960 x 540)", 31 | "screenSize": "4.0 inches", 32 | "touchScreen": true 33 | }, 34 | "hardware": { 35 | "accelerometer": true, 36 | "audioJack": "3.5mm", 37 | "cpu": "1 GHz Dual Core", 38 | "fmRadio": false, 39 | "physicalKeyboard": false, 40 | "usb": "USB 2.0" 41 | }, 42 | "id": "motorola-atrix-4g", 43 | "images": [ 44 | "img/phones/motorola-atrix-4g.0.jpg", 45 | "img/phones/motorola-atrix-4g.1.jpg", 46 | "img/phones/motorola-atrix-4g.2.jpg", 47 | "img/phones/motorola-atrix-4g.3.jpg" 48 | ], 49 | "name": "MOTOROLA ATRIX\u2122 4G", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "63.5 mm (w)", 53 | "117.75 mm (h)", 54 | "10.95 mm (d)" 55 | ], 56 | "weight": "135.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "", 60 | "ram": "" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/motorola-bravo-with-motoblur.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Adobe\u00ae Flash\u00ae Lite\u00ae 3, DNLA, CrystalTalk\u2122 PLUS technology", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "MOTOBLUR\u2122" 6 | }, 7 | "availability": [ 8 | "AT&T" 9 | ], 10 | "battery": { 11 | "standbyTime": "216 hours", 12 | "talkTime": "6 hours", 13 | "type": "Lithium Ion (Li-Ion) (1540 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Video" 18 | ], 19 | "primary": "3.0 megapixels" 20 | }, 21 | "connectivity": { 22 | "bluetooth": "Bluetooth 2.1", 23 | "cell": "WCDMA 850/1900, GSM 850/900/1800/1900, HSDPA 7.2 Mbps (Category 7/8), EDGE Class 12, GPRS Class 12, HSUPA 2.0 Mbps", 24 | "gps": true, 25 | "infrared": false, 26 | "wifi": "802.11 b/g/n" 27 | }, 28 | "description": "MOTOROLA BRAVO\u2122 with MOTOBLUR\u2122 with its large 3.7-inch touchscreen and web-browsing capabilities is sure to make an impression. And it keeps your life updated and secure through MOTOBLUR.", 29 | "display": { 30 | "screenResolution": "WVGA (800 x 480)", 31 | "screenSize": "3.7 inches", 32 | "touchScreen": true 33 | }, 34 | "hardware": { 35 | "accelerometer": true, 36 | "audioJack": "3.5mm", 37 | "cpu": "800 Mhz", 38 | "fmRadio": true, 39 | "physicalKeyboard": false, 40 | "usb": "USB 2.0" 41 | }, 42 | "id": "motorola-bravo-with-motoblur", 43 | "images": [ 44 | "img/phones/motorola-bravo-with-motoblur.0.jpg", 45 | "img/phones/motorola-bravo-with-motoblur.1.jpg", 46 | "img/phones/motorola-bravo-with-motoblur.2.jpg" 47 | ], 48 | "name": "MOTOROLA BRAVO\u2122 with MOTOBLUR\u2122", 49 | "sizeAndWeight": { 50 | "dimensions": [ 51 | "63.0 mm (w)", 52 | "109.0 mm (h)", 53 | "13.3 mm (d)" 54 | ], 55 | "weight": "130.0 grams" 56 | }, 57 | "storage": { 58 | "flash": "", 59 | "ram": "" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/motorola-charm-with-motoblur.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "MOTOBLUR-enabled; battery manager; seven home screens; customize by moving or resizing widgets; Android HTML WebKit w/Flash Lite; BACKTRACK\u2122 navigation pad behind screen", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "MOTOBLUR" 6 | }, 7 | "availability": [ 8 | "T-Mobile,", 9 | "Telus" 10 | ], 11 | "battery": { 12 | "standbyTime": "267 hours", 13 | "talkTime": "5 hours", 14 | "type": "Lithium Ion (Li-Ion) (1170 mAH)" 15 | }, 16 | "camera": { 17 | "features": [ 18 | "Video" 19 | ], 20 | "primary": "3.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.0", 24 | "cell": "WCDMA 1700/2100, GSM 850/900/1800/1900, HSDPA 3.6 Mbps (Category 5/6), EDGE Class 12, GPRS Class 12", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g" 28 | }, 29 | "description": "Motorola CHARM fits easily in your pocket or palm. Includes MOTOBLUR so you can sync and merge your contacts, emails, messages and posts with continuous updates and back-ups.", 30 | "display": { 31 | "screenResolution": "QVGA (320 x 240)", 32 | "screenSize": "2.8 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "600 MHz", 39 | "fmRadio": false, 40 | "physicalKeyboard": true, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "motorola-charm-with-motoblur", 44 | "images": [ 45 | "img/phones/motorola-charm-with-motoblur.0.jpg", 46 | "img/phones/motorola-charm-with-motoblur.1.jpg", 47 | "img/phones/motorola-charm-with-motoblur.2.jpg" 48 | ], 49 | "name": "Motorola CHARM\u2122 with MOTOBLUR\u2122", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "67.2 mm (w)", 53 | "98.4 mm (h)", 54 | "11.4 mm (d)" 55 | ], 56 | "weight": "110.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "150MB", 60 | "ram": "512MB" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/t-mobile-g2.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Accessibility features: tactile QWERTY keyboard, trackpad, three programmable keys, camera button", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "Android" 6 | }, 7 | "availability": [ 8 | "T-Mobile" 9 | ], 10 | "battery": { 11 | "standbyTime": "420 hours", 12 | "talkTime": "7 hours", 13 | "type": "Lithium Ion (Li-Ion) (1300 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "GSM: 850, 900, 1800, 1900 UMTS: Yes", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "The T-Mobile G1 was the world's first Android-powered phone. Launched nearly two years ago, it created an entirely new class of mobile phones and apps. Its successor, the T-Mobile G2 with Google, will continue the revolution.\n\nThe T-Mobile G2 will deliver tight integration with Google services and break new ground as the first smartphone designed to run at 4G speeds on our new HSPA+ network.", 30 | "display": { 31 | "screenResolution": "WVGA (800 x 480)", 32 | "screenSize": "3.7 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "800 MHz Qualcomm\u00ae Snapdragon\u2122 MSM7230", 39 | "fmRadio": false, 40 | "physicalKeyboard": true, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "t-mobile-g2", 44 | "images": [ 45 | "img/phones/t-mobile-g2.0.jpg", 46 | "img/phones/t-mobile-g2.1.jpg", 47 | "img/phones/t-mobile-g2.2.jpg" 48 | ], 49 | "name": "T-Mobile G2", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "60.4 mm (w)", 53 | "119.0 mm (h)", 54 | "14.2 mm (d)" 55 | ], 56 | "weight": "180.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "4000MB", 60 | "ram": "512MB" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/motorola-xoom-with-wi-fi.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Sensors: proximity, ambient light, barometer, gyroscope", 3 | "android": { 4 | "os": "Android 3.0", 5 | "ui": "Honeycomb" 6 | }, 7 | "availability": [ 8 | "" 9 | ], 10 | "battery": { 11 | "standbyTime": "336 hours", 12 | "talkTime": "24 hours", 13 | "type": "Other ( mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "Motorola XOOM with Wi-Fi has a super-powerful dual-core processor and Android\u2122 3.0 (Honeycomb) \u2014 the Android platform designed specifically for tablets. With its 10.1-inch HD widescreen display, you\u2019ll enjoy HD video in a thin, light, powerful and upgradeable tablet.", 30 | "display": { 31 | "screenResolution": "WXGA (1200 x 800)", 32 | "screenSize": "10.1 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "1 GHz Dual Core Tegra 2", 39 | "fmRadio": false, 40 | "physicalKeyboard": false, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "motorola-xoom-with-wi-fi", 44 | "images": [ 45 | "img/phones/motorola-xoom-with-wi-fi.0.jpg", 46 | "img/phones/motorola-xoom-with-wi-fi.1.jpg", 47 | "img/phones/motorola-xoom-with-wi-fi.2.jpg", 48 | "img/phones/motorola-xoom-with-wi-fi.3.jpg", 49 | "img/phones/motorola-xoom-with-wi-fi.4.jpg", 50 | "img/phones/motorola-xoom-with-wi-fi.5.jpg" 51 | ], 52 | "name": "Motorola XOOM\u2122 with Wi-Fi", 53 | "sizeAndWeight": { 54 | "dimensions": [ 55 | "249.1 mm (w)", 56 | "167.8 mm (h)", 57 | "12.9 mm (d)" 58 | ], 59 | "weight": "708.0 grams" 60 | }, 61 | "storage": { 62 | "flash": "32000MB", 63 | "ram": "1000MB" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/lg-axis.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Accessibility features: Tactile QWERTY keyboard, four-direction keypad, start and end call buttons, dedicated number keys, camera button, TalkBack screen reader", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "LG Home" 6 | }, 7 | "availability": [ 8 | "Cellular South" 9 | ], 10 | "battery": { 11 | "standbyTime": "500 hours", 12 | "talkTime": "8 hours", 13 | "type": "Lithium Ion (Li-Ion) (1500 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "3.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "1.9 GHz CDMA PCS, 800 MHz CDMA, EVDO Rev. A, 1xRTT", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g" 28 | }, 29 | "description": "Android plus QWERTY is a powerful duo. LG Axis melds a speedy UI with the limitless micro-entertainment of 80,000+ apps including voice-activated Google. Feel the tactile vibration on its tempered glass touchscreen. Take the fuzziness out of your fun with a 3.2MP camera that does 360\u00b0 panoramics. And customize your home screens with shortcuts to your apps, favorites, and widgets. It's the centerpiece of your life.", 30 | "display": { 31 | "screenResolution": "WVGA (800 x 480)", 32 | "screenSize": "3.2 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "", 38 | "cpu": "600 MHz Qualcomm MSM7627", 39 | "fmRadio": false, 40 | "physicalKeyboard": true, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "lg-axis", 44 | "images": [ 45 | "img/phones/lg-axis.0.jpg", 46 | "img/phones/lg-axis.1.jpg", 47 | "img/phones/lg-axis.2.jpg" 48 | ], 49 | "name": "LG Axis", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "56.0 mm (w)", 53 | "116.0 mm (h)", 54 | "16.0 mm (d)" 55 | ], 56 | "weight": "158.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "126MB", 60 | "ram": "256MB" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/motorola-defy-with-motoblur.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Blockbuster On Demand\u00ae movies and music downloads with connected music player\nWater-resistant and dustproof", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "MOTOBLUR" 6 | }, 7 | "availability": [ 8 | "SFR,", 9 | "T-Mobile,", 10 | "Vodafone" 11 | ], 12 | "battery": { 13 | "standbyTime": "400 hours", 14 | "talkTime": "6 hours", 15 | "type": "Lithium Ion (Li-Ion) (1540 mAH)" 16 | }, 17 | "camera": { 18 | "features": [ 19 | "Flash", 20 | "Video" 21 | ], 22 | "primary": "5.0 megapixels" 23 | }, 24 | "connectivity": { 25 | "bluetooth": "Bluetooth 2.1", 26 | "cell": "WCDMA 850/1700/2100, GSM 850/900/1800/1900, HSDPA 7.2 Mbps (Category 7/8), EDGE Class 12, GPRS Class 12, HSUPA 2.0 Mbps", 27 | "gps": true, 28 | "infrared": false, 29 | "wifi": "802.11 b/g/n" 30 | }, 31 | "description": "DEFY with MOTOBLUR is ready for everything life throws your way. It's water-resistant and dustproof, with plenty of entertainment options; and, with MOTOBLUR, it automatically delivers messages and status updates right to your home screen.", 32 | "display": { 33 | "screenResolution": "FWVGA (854 x 480)", 34 | "screenSize": "3.7 inches", 35 | "touchScreen": true 36 | }, 37 | "hardware": { 38 | "accelerometer": true, 39 | "audioJack": "3.5mm", 40 | "cpu": "800 MHz TI OMAP3610", 41 | "fmRadio": false, 42 | "physicalKeyboard": false, 43 | "usb": "USB 2.0" 44 | }, 45 | "id": "motorola-defy-with-motoblur", 46 | "images": [ 47 | "img/phones/motorola-defy-with-motoblur.0.jpg", 48 | "img/phones/motorola-defy-with-motoblur.1.jpg", 49 | "img/phones/motorola-defy-with-motoblur.2.jpg" 50 | ], 51 | "name": "Motorola DEFY\u2122 with MOTOBLUR\u2122", 52 | "sizeAndWeight": { 53 | "dimensions": [ 54 | "59.0 mm (w)", 55 | "107.0 mm (h)", 56 | "13.4 mm (d)" 57 | ], 58 | "weight": "118.0 grams" 59 | }, 60 | "storage": { 61 | "flash": "2000MB", 62 | "ram": "512MB" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/droid-pro-by-motorola.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Adobe Flash Player 10, Quadband GSM Worldphone, Advance Business Security, Complex Password Secure, Review & Edit Documents with Quick Office, Personal 3G Mobile Hotspot for up to 5 WiFi enabled Devices, Advanced Social Networking brings all social content into a single homescreen widget", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "" 6 | }, 7 | "availability": [ 8 | "Verizon" 9 | ], 10 | "battery": { 11 | "standbyTime": "330 hours", 12 | "talkTime": "7 hours", 13 | "type": "Lithium Ion (Li-Ion) (1400 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "800/1900 CDMA EVDO Rev. A with dual diversity antenna, 850/900/1800/1900MHz GSM, GPRS Class 12, EDGE Class 12, 850/1900/2100 WCDMA (category 9/10), HSDPA 10.2mbps, HSUPA 1.8 mbps", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "Access your work directory, email or calendar with DROID Pro by Motorola., an Android-for-business smartphone with corporate-level security. It features both a QWERTY keyboard and touchscreen, a speedy 1 GHz processor and Adobe\u00ae Flash\u00ae Player 10.", 30 | "display": { 31 | "screenResolution": "HVGA (480 x 320)", 32 | "screenSize": "3.1 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "1 GHz TI OMAP", 39 | "fmRadio": false, 40 | "physicalKeyboard": true, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "droid-pro-by-motorola", 44 | "images": [ 45 | "img/phones/droid-pro-by-motorola.0.jpg", 46 | "img/phones/droid-pro-by-motorola.1.jpg" 47 | ], 48 | "name": "DROID\u2122 Pro by Motorola", 49 | "sizeAndWeight": { 50 | "dimensions": [ 51 | "61.0 mm (w)", 52 | "119.0 mm (h)", 53 | "11.7 mm (d)" 54 | ], 55 | "weight": "134.0 grams" 56 | }, 57 | "storage": { 58 | "flash": "2048MB", 59 | "ram": "512MB" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/samsung-gem.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "3.2\u201d Full touch screen with Advanced anti smudge, anti reflective and anti scratch glass; Swype text input for easy and fast message creation; multiple messaging options, including text with threaded messaging for organized, easy-to-follow text; Social Community support, including Facebook and MySpace; Next generation Address book; Visual Voice Mail\n", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "TouchWiz" 6 | }, 7 | "availability": [ 8 | "Cellular South" 9 | ], 10 | "battery": { 11 | "standbyTime": "800 hours", 12 | "talkTime": "7 hours", 13 | "type": "Nickel Cadmium (NiCd) (1500 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "" 18 | ], 19 | "primary": "3.0 megapixels" 20 | }, 21 | "connectivity": { 22 | "bluetooth": "Bluetooth 3.0", 23 | "cell": "3G/CDMA : 850MHz/1900MHz\n", 24 | "gps": true, 25 | "infrared": false, 26 | "wifi": "802.11 b/g" 27 | }, 28 | "description": "The Samsung Gem\u2122 maps a route to a smarter mobile experience. By pairing one of the fastest processors in the category with the Android\u2122 platform, the Gem delivers maximum multitasking speed and social networking capabilities to let you explore new territory online. A smart phone at an even smarter price is a real find, so uncover the Gem and discover what\u2019s next.", 29 | "display": { 30 | "screenResolution": "WQVGA (400 x 240)", 31 | "screenSize": "3.2 inches", 32 | "touchScreen": true 33 | }, 34 | "hardware": { 35 | "accelerometer": true, 36 | "audioJack": "3.5mm", 37 | "cpu": "800 MHz", 38 | "fmRadio": false, 39 | "physicalKeyboard": false, 40 | "usb": "USB 2.0" 41 | }, 42 | "id": "samsung-gem", 43 | "images": [ 44 | "img/phones/samsung-gem.0.jpg", 45 | "img/phones/samsung-gem.1.jpg", 46 | "img/phones/samsung-gem.2.jpg" 47 | ], 48 | "name": "Samsung Gem\u2122", 49 | "sizeAndWeight": { 50 | "dimensions": [ 51 | "55.5 mm (w)", 52 | "113.0 mm (h)", 53 | "12.4 mm (d)" 54 | ], 55 | "weight": "110.0 grams" 56 | }, 57 | "storage": { 58 | "flash": "220MB", 59 | "ram": "256MB" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/droid-2-global-by-motorola.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Adobe Flash Player 10, Quadband GSM Worldphone, Advance Business Security, Complex Password Secure, Review & Edit Documents with Quick Office, Personal 3G Mobile Hotspot for up to 5 WiFi enabled Devices, Advanced Social Networking brings all social content into a single homescreen widget", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "" 6 | }, 7 | "availability": [ 8 | "Verizon" 9 | ], 10 | "battery": { 11 | "standbyTime": "230 hours", 12 | "talkTime": "8 hours", 13 | "type": "Lithium Ion (Li-Ion) (1400 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "WCDMA 850/1900/2100, CDMA 800/1900, GSM 850/900/1800/1900, HSDPA 10.2 Mbps (Category 9/10), CDMA EV-DO Release A, EDGE Class 12, GPRS Class 12, HSUPA 1.8 Mbps", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "With Quad Band GSM, the DROID 2 Global can send email and make and receive calls from more than 200 countries. It features an improved QWERTY keyboard, super-fast 1.2 GHz processor and enhanced security for all your business needs.", 30 | "display": { 31 | "screenResolution": "FWVGA (854 x 480)", 32 | "screenSize": "3.7 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "1.2 GHz TI OMAP", 39 | "fmRadio": false, 40 | "physicalKeyboard": true, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "droid-2-global-by-motorola", 44 | "images": [ 45 | "img/phones/droid-2-global-by-motorola.0.jpg", 46 | "img/phones/droid-2-global-by-motorola.1.jpg", 47 | "img/phones/droid-2-global-by-motorola.2.jpg" 48 | ], 49 | "name": "DROID\u2122 2 Global by Motorola", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "60.5 mm (w)", 53 | "116.3 mm (h)", 54 | "13.7 mm (d)" 55 | ], 56 | "weight": "169.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "8192MB", 60 | "ram": "512MB" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/dell-streak-7.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Front Facing 1.3MP Camera", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "Dell Stage" 6 | }, 7 | "availability": [ 8 | "T-Mobile" 9 | ], 10 | "battery": { 11 | "standbyTime": "", 12 | "talkTime": "", 13 | "type": "Lithium Ion (Li-Ion) (2780 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "T-mobile HSPA+ @ 2100/1900/AWS/850 MHz", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g" 28 | }, 29 | "description": "Introducing Dell\u2122 Streak 7. Share photos, videos and movies together. It\u2019s small enough to carry around, big enough to gather around. Android\u2122 2.2-based tablet with over-the-air upgrade capability for future OS releases. A vibrant 7-inch, multitouch display with full Adobe\u00ae Flash 10.1 pre-installed. Includes a 1.3 MP front-facing camera for face-to-face chats on popular services such as Qik or Skype. 16 GB of internal storage, plus Wi-Fi, Bluetooth and built-in GPS keeps you in touch with the world around you. Connect on your terms. Save with 2-year contract or flexibility with prepaid pay-as-you-go plans", 30 | "display": { 31 | "screenResolution": "WVGA (800 x 480)", 32 | "screenSize": "7.0 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "nVidia Tegra T20", 39 | "fmRadio": false, 40 | "physicalKeyboard": false, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "dell-streak-7", 44 | "images": [ 45 | "img/phones/dell-streak-7.0.jpg", 46 | "img/phones/dell-streak-7.1.jpg", 47 | "img/phones/dell-streak-7.2.jpg", 48 | "img/phones/dell-streak-7.3.jpg", 49 | "img/phones/dell-streak-7.4.jpg" 50 | ], 51 | "name": "Dell Streak 7", 52 | "sizeAndWeight": { 53 | "dimensions": [ 54 | "199.9 mm (w)", 55 | "119.8 mm (h)", 56 | "12.4 mm (d)" 57 | ], 58 | "weight": "450.0 grams" 59 | }, 60 | "storage": { 61 | "flash": "16000MB", 62 | "ram": "512MB" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/ngLink.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @name ngLink 3 | * @description 4 | * Lets you link to different parts of the app, and automatically generates hrefs. 5 | * 6 | * ## Use 7 | * The directive uses a simple syntax: `ng-link="componentName({ param: paramValue })"` 8 | * 9 | * ### Example 10 | * 11 | * ```js 12 | * angular.module('myApp', ['ngComponentRouter']) 13 | * .controller('AppController', ['$rootRouter', function($rootRouter) { 14 | * $rootRouter.config({ path: '/user/:id', component: 'user' }); 15 | * this.user = { name: 'Brian', id: 123 }; 16 | * }); 17 | * ``` 18 | * 19 | * ```html 20 | *
21 | * {{app.user.name}} 22 | *
23 | * ``` 24 | */ 25 | module.exports = function ngLinkDirective($rootRouter, $parse) { 26 | return {require: '?^^ngOutlet', restrict: 'A', link: ngLinkDirectiveLinkFn}; 27 | 28 | function ngLinkDirectiveLinkFn(scope, element, attrs, ctrl) { 29 | var router = (ctrl && ctrl.$$router) || $rootRouter; 30 | if (!router) { 31 | return; 32 | } 33 | 34 | var navigationInstruction = null; 35 | var link = attrs.ngLink || ''; 36 | 37 | function getLink(params) { 38 | navigationInstruction = router.generate(params); 39 | 40 | scope.$watch(function() { return router.isRouteActive(navigationInstruction); }, 41 | function(active) { 42 | if (active) { 43 | element.addClass('ng-link-active'); 44 | } else { 45 | element.removeClass('ng-link-active'); 46 | } 47 | }); 48 | 49 | var navigationHref = navigationInstruction.toLinkUrl(); 50 | return $rootRouter._location.prepareExternalUrl(navigationHref); 51 | } 52 | 53 | var routeParamsGetter = $parse(link); 54 | // we can avoid adding a watcher if it's a literal 55 | if (routeParamsGetter.constant) { 56 | var params = routeParamsGetter(); 57 | element.attr('href', getLink(params)); 58 | } else { 59 | scope.$watch( 60 | function() { return routeParamsGetter(scope); }, 61 | function(params) { return element.attr('href', getLink(params)); }, 62 | true); 63 | } 64 | 65 | element.on('click', function(event) { 66 | if (event.which !== 1 || !navigationInstruction) { 67 | return; 68 | } 69 | 70 | $rootRouter.navigateByInstruction(navigationInstruction); 71 | event.preventDefault(); 72 | }); 73 | } 74 | }; -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/samsung-showcase-a-galaxy-s-phone.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Swype", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "TouchWiz" 6 | }, 7 | "availability": [ 8 | "Cellular South" 9 | ], 10 | "battery": { 11 | "standbyTime": "800 hours", 12 | "talkTime": "7 hours", 13 | "type": "Lithium Ion (Li-Ion) (1500 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 3.0", 24 | "cell": "3G : 900MHz/1900MHz\nCDMA : 800MHz/1900MHz", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "Experience entertainment in a whole new light. The stylish and slim Samsung Showcase\u2122, with its vivid 4-inch Super AMOLED\u2122 display, makes everything from Hollywood blockbusters to music videos to Amazon\u2019s bestsellers look absolutely brilliant \u2013 even outside in the sun. Android\u2122 Market rockets you into a universe filled with equally brilliant apps; download them at blistering speeds thanks to the powerful 1GHz Hummingbird processor. Keep your social life organized and continuously updated with the pre-loaded social networking apps, while uploading all the 5.0MP pics you\u2019ve snapped and 720p HD videos you\u2019ve recorded", 30 | "display": { 31 | "screenResolution": "WVGA (800 x 480)", 32 | "screenSize": "4.0 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "1 GHz", 39 | "fmRadio": false, 40 | "physicalKeyboard": false, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "samsung-showcase-a-galaxy-s-phone", 44 | "images": [ 45 | "img/phones/samsung-showcase-a-galaxy-s-phone.0.jpg", 46 | "img/phones/samsung-showcase-a-galaxy-s-phone.1.jpg", 47 | "img/phones/samsung-showcase-a-galaxy-s-phone.2.jpg" 48 | ], 49 | "name": "Samsung Showcase\u2122 a Galaxy S\u2122 phone", 50 | "sizeAndWeight": { 51 | "dimensions": [ 52 | "64.2 mm (w)", 53 | "125.0 mm (h)", 54 | "9.97 mm (d)" 55 | ], 56 | "weight": "118.0 grams" 57 | }, 58 | "storage": { 59 | "flash": "2048MB", 60 | "ram": "512MB" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/t-mobile-mytouch-4g.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Mobile Video Chat, HD Camcorder, Screen Share (DLNA), Genius Button, Wi-Fi Calling, Wi-Fi HotSpot, T-Mobile TV, Slacker Radio, Rock Band, Monopoly, Asphalt 5, myModes, Faves Gallery", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "HTC Sense\u2122" 6 | }, 7 | "availability": [ 8 | "T-Mobile" 9 | ], 10 | "battery": { 11 | "standbyTime": "285 hours", 12 | "talkTime": "7 hours", 13 | "type": "Lithium Ion (Li-Ion) (1400 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.0", 24 | "cell": "GSM: 850, 900, 1800, 1900; UMTS: Band I/IV", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "The myTouch 4G lets you connect fast, communicate easily, and share\u2014all on America\u2019s largest 4G network.\n\nBuilt with families in mind, the newest T-Mobile myTouch 4G helps solve the challenges of staying physically and emotionally connected by sharing photos and video with the HD Camcorder, spontaneous face-to-face conversations through Video Chat, and the ability to reach 4G speeds on T-Mobile\u2019s HSPA+ network.", 30 | "display": { 31 | "screenResolution": "WVGA (800 x 480)", 32 | "screenSize": "3.8 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "2nd Generation 1GHz Qualcomm Snapdragon MSM8255", 39 | "fmRadio": true, 40 | "physicalKeyboard": false, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "t-mobile-mytouch-4g", 44 | "images": [ 45 | "img/phones/t-mobile-mytouch-4g.0.jpg", 46 | "img/phones/t-mobile-mytouch-4g.1.jpg", 47 | "img/phones/t-mobile-mytouch-4g.2.jpg", 48 | "img/phones/t-mobile-mytouch-4g.3.jpg", 49 | "img/phones/t-mobile-mytouch-4g.4.jpg", 50 | "img/phones/t-mobile-mytouch-4g.5.jpg" 51 | ], 52 | "name": "T-Mobile myTouch 4G", 53 | "sizeAndWeight": { 54 | "dimensions": [ 55 | "62.5 mm (w)", 56 | "122.0 mm (h)", 57 | "11.0 mm (d)" 58 | ], 59 | "weight": "156.0 grams" 60 | }, 61 | "storage": { 62 | "flash": "1100MB", 63 | "ram": "768MB" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/samsung-mesmerize-a-galaxy-s-phone.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Swype", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "TouchWiz" 6 | }, 7 | "availability": [ 8 | "US Cellular" 9 | ], 10 | "battery": { 11 | "standbyTime": "1000 hours", 12 | "talkTime": "7 hours", 13 | "type": "Lithium Ion (Li-Ion) (1500 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "5.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 3.0", 24 | "cell": "3G :800MHz/1900MHz\nCDMA :800MHz/1900MHz", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "Experience entertainment in a whole new light. The stylish and slim Samsung Mesmerize\u2122, with its vivid 4-inch Super AMOLED\u2122 display, makes everything from Hollywood blockbusters to music videos to Amazon\u2019s bestsellers look absolutely brilliant \u2013 even outside in the sun. Android\u2122 Market rockets you into a universe filled with equally brilliant apps; download them at blistering speeds thanks to the powerful 1GHz Hummingbird processor. Keep your social life organized and continuously updated with the pre-loaded social networking apps, while uploading all the 5.0MP pics you\u2019ve snapped and 720p HD videos you\u2019ve recorded.", 30 | "display": { 31 | "screenResolution": "WVGA (800 x 480)", 32 | "screenSize": "4.0 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "", 38 | "cpu": "1GHz", 39 | "fmRadio": false, 40 | "physicalKeyboard": false, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "samsung-mesmerize-a-galaxy-s-phone", 44 | "images": [ 45 | "img/phones/samsung-mesmerize-a-galaxy-s-phone.0.jpg", 46 | "img/phones/samsung-mesmerize-a-galaxy-s-phone.1.jpg", 47 | "img/phones/samsung-mesmerize-a-galaxy-s-phone.2.jpg", 48 | "img/phones/samsung-mesmerize-a-galaxy-s-phone.3.jpg" 49 | ], 50 | "name": "Samsung Mesmerize\u2122 a Galaxy S\u2122 phone", 51 | "sizeAndWeight": { 52 | "dimensions": [ 53 | "64.2 mm (w)", 54 | "125.0 mm (h)", 55 | "9.97 mm (d)" 56 | ], 57 | "weight": "118.0 grams" 58 | }, 59 | "storage": { 60 | "flash": "2048MB", 61 | "ram": "512MB" 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/samsung-transform.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Access to Sprint ID Service Packs, front and rear facing cameras\n", 3 | "android": { 4 | "os": "Android 2.1", 5 | "ui": "Stock Android + Sprint ID Pack" 6 | }, 7 | "availability": [ 8 | "Sprint" 9 | ], 10 | "battery": { 11 | "standbyTime": "930 hours", 12 | "talkTime": "9 hours", 13 | "type": "Lithium Ion (Li-Ion) (1500 mAH)" 14 | }, 15 | "camera": { 16 | "features": [ 17 | "Flash", 18 | "Video" 19 | ], 20 | "primary": "3.0 megapixels" 21 | }, 22 | "connectivity": { 23 | "bluetooth": "Bluetooth 2.1", 24 | "cell": "800Mhz, 1900MHz", 25 | "gps": true, 26 | "infrared": false, 27 | "wifi": "802.11 b/g/n" 28 | }, 29 | "description": "Change your perspective. The Samsung Transform\u2122 is an Android powered device that delivers the truly customizable experience you want your phone to provide. Enjoy a new and easy way to personalize your device for business or for entertainment, showcasing your own favorite theme and more through the new open software platform and the ability to download individual \u2018Sprint ID Service Packs\u2019 that combine and deliver multiple content items and applications specifically for the features you want. Combine this with the 3.5\u201d touch display, QWERTY keyboard, high-speed processor, and both a front and rear facing camera to bring your unique mobile experience to life.", 30 | "display": { 31 | "screenResolution": "HVGA (480 x 320)", 32 | "screenSize": "3.5 inches", 33 | "touchScreen": true 34 | }, 35 | "hardware": { 36 | "accelerometer": true, 37 | "audioJack": "3.5mm", 38 | "cpu": "800 MHz", 39 | "fmRadio": false, 40 | "physicalKeyboard": true, 41 | "usb": "USB 2.0" 42 | }, 43 | "id": "samsung-transform", 44 | "images": [ 45 | "img/phones/samsung-transform.0.jpg", 46 | "img/phones/samsung-transform.1.jpg", 47 | "img/phones/samsung-transform.2.jpg", 48 | "img/phones/samsung-transform.3.jpg", 49 | "img/phones/samsung-transform.4.jpg" 50 | ], 51 | "name": "Samsung Transform\u2122", 52 | "sizeAndWeight": { 53 | "dimensions": [ 54 | "61.5 mm (w)", 55 | "117.0 mm (h)", 56 | "15.3 mm (d)" 57 | ], 58 | "weight": "148.0 grams" 59 | }, 60 | "storage": { 61 | "flash": "180MB", 62 | "ram": "384MB" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/dell-venue.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Gorilla Glass display, Dedicated Camera Key, Ring Silence Switch, Swype keyboard.", 3 | "android": { 4 | "os": "Android 2.2", 5 | "ui": "Dell Stage" 6 | }, 7 | "availability": [ 8 | "AT&T,", 9 | "KT,", 10 | "T-Mobile" 11 | ], 12 | "battery": { 13 | "standbyTime": "400 hours", 14 | "talkTime": "7 hours", 15 | "type": "Lithium Ion (Li-Ion) (1400 mAH)" 16 | }, 17 | "camera": { 18 | "features": [ 19 | "Flash", 20 | "Video" 21 | ], 22 | "primary": "8.0 megapixels" 23 | }, 24 | "connectivity": { 25 | "bluetooth": "Bluetooth 2.1", 26 | "cell": "850/1900/2100 3G; 850/900/1800/1900 GSM/GPRS/EDGE\n900/1700/2100 3G; 850/900/1800/1900 GSM/GPRS/EDGE", 27 | "gps": true, 28 | "infrared": false, 29 | "wifi": "802.11 b/g/n" 30 | }, 31 | "description": "The Venue is the perfect one-touch, Smart Phone providing instant access to everything you love. All of Venue's features make it perfect for on-the-go students, mobile professionals, and active social communicators who love style and performance.\n\nElegantly designed, the Venue offers a vibrant, curved glass display that\u2019s perfect for viewing all types of content. The Venue\u2019s slender form factor feels great in your hand and also slips easily into your pocket. A mobile entertainment powerhouse that lets you download the latest tunes from Amazon MP3 or books from Kindle, watch video, or stream your favorite radio stations. All on the go, anytime, anywhere.", 32 | "display": { 33 | "screenResolution": "WVGA (800 x 480)", 34 | "screenSize": "4.1 inches", 35 | "touchScreen": true 36 | }, 37 | "hardware": { 38 | "accelerometer": true, 39 | "audioJack": "3.5mm", 40 | "cpu": "1 Ghz processor", 41 | "fmRadio": false, 42 | "physicalKeyboard": false, 43 | "usb": "USB 2.0" 44 | }, 45 | "id": "dell-venue", 46 | "images": [ 47 | "img/phones/dell-venue.0.jpg", 48 | "img/phones/dell-venue.1.jpg", 49 | "img/phones/dell-venue.2.jpg", 50 | "img/phones/dell-venue.3.jpg", 51 | "img/phones/dell-venue.4.jpg", 52 | "img/phones/dell-venue.5.jpg" 53 | ], 54 | "name": "Dell Venue", 55 | "sizeAndWeight": { 56 | "dimensions": [ 57 | "64.0 mm (w)", 58 | "121.0 mm (h)", 59 | "12.9 mm (d)" 60 | ], 61 | "weight": "164.0 grams" 62 | }, 63 | "storage": { 64 | "flash": "1000MB", 65 | "ram": "512MB" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/nexus-s.json: -------------------------------------------------------------------------------- 1 | { 2 | "additionalFeatures": "Contour Display, Near Field Communications (NFC), Three-axis gyroscope, Anti-fingerprint display coating, Internet Calling support (VoIP/SIP)", 3 | "android": { 4 | "os": "Android 2.3", 5 | "ui": "Android" 6 | }, 7 | "availability": [ 8 | "M1,", 9 | "O2,", 10 | "Orange,", 11 | "Singtel,", 12 | "StarHub,", 13 | "T-Mobile,", 14 | "Vodafone" 15 | ], 16 | "battery": { 17 | "standbyTime": "428 hours", 18 | "talkTime": "6 hours", 19 | "type": "Lithium Ion (Li-Ion) (1500 mAH)" 20 | }, 21 | "camera": { 22 | "features": [ 23 | "Flash", 24 | "Video" 25 | ], 26 | "primary": "5.0 megapixels" 27 | }, 28 | "connectivity": { 29 | "bluetooth": "Bluetooth 2.1", 30 | "cell": "Quad-band GSM: 850, 900, 1800, 1900\r\nTri-band HSPA: 900, 2100, 1700\r\nHSPA type: HSDPA (7.2Mbps) HSUPA (5.76Mbps)", 31 | "gps": true, 32 | "infrared": false, 33 | "wifi": "802.11 b/g/n" 34 | }, 35 | "description": "Nexus S is the next generation of Nexus devices, co-developed by Google and Samsung. The latest Android platform (Gingerbread), paired with a 1 GHz Hummingbird processor and 16GB of memory, makes Nexus S one of the fastest phones on the market. It comes pre-installed with the best of Google apps and enabled with new and popular features like true multi-tasking, Wi-Fi hotspot, Internet Calling, NFC support, and full web browsing. With this device, users will also be the first to receive software upgrades and new Google mobile apps as soon as they become available. For more details, visit http://www.google.com/nexus.", 36 | "display": { 37 | "screenResolution": "WVGA (800 x 480)", 38 | "screenSize": "4.0 inches", 39 | "touchScreen": true 40 | }, 41 | "hardware": { 42 | "accelerometer": true, 43 | "audioJack": "3.5mm", 44 | "cpu": "1GHz Cortex A8 (Hummingbird) processor", 45 | "fmRadio": false, 46 | "physicalKeyboard": false, 47 | "usb": "USB 2.0" 48 | }, 49 | "id": "nexus-s", 50 | "images": [ 51 | "img/phones/nexus-s.0.jpg", 52 | "img/phones/nexus-s.1.jpg", 53 | "img/phones/nexus-s.2.jpg", 54 | "img/phones/nexus-s.3.jpg" 55 | ], 56 | "name": "Nexus S", 57 | "sizeAndWeight": { 58 | "dimensions": [ 59 | "63.0 mm (w)", 60 | "123.9 mm (h)", 61 | "10.88 mm (d)" 62 | ], 63 | "weight": "129.0 grams" 64 | }, 65 | "storage": { 66 | "flash": "16384MB", 67 | "ram": "512MB" 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /examples/heroes/app/heroes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | angular.module('heroes', []) 4 | .service('heroService', HeroService) 5 | 6 | .component('heroes', { 7 | template: '

Heroes

', 8 | $routeConfig: [ 9 | {path: '/', name: 'HeroList', component: 'heroList', useAsDefault: true}, 10 | {path: '/:id', name: 'HeroDetail', component: 'heroDetail'} 11 | ] 12 | }) 13 | 14 | .component('heroList', { 15 | template: 16 | '
\n' + 18 | '{{hero.name}}\n' + 19 | '
', 20 | controller: HeroListComponent 21 | }) 22 | 23 | .component('heroDetail', { 24 | template: 25 | '
\n' + 26 | '

"{{$ctrl.hero.name}}"

\n' + 27 | '
\n' + 28 | ' {{$ctrl.hero.id}}
\n' + 29 | '
\n' + 30 | ' \n' + 31 | ' \n' + 32 | '
\n' + 33 | ' \n' + 34 | '
\n', 35 | bindings: { $router: '<' }, 36 | controller: HeroDetailComponent 37 | }); 38 | 39 | 40 | function HeroService($q) { 41 | var heroesPromise = $q.when([ 42 | { id: 11, name: 'Mr. Nice' }, 43 | { id: 12, name: 'Narco' }, 44 | { id: 13, name: 'Bombasto' }, 45 | { id: 14, name: 'Celeritas' }, 46 | { id: 15, name: 'Magneta' }, 47 | { id: 16, name: 'RubberMan' } 48 | ]); 49 | 50 | this.getHeroes = function() { 51 | return heroesPromise; 52 | }; 53 | 54 | this.getHero = function(id) { 55 | return heroesPromise.then(function(heroes) { 56 | for(var i=0; i 43 | $ travis encrypt GITHUB_TOKEN= --add 44 | ``` 45 | 46 | > On Mac OS X, if `gem install travis` fails, you may have to install the latest version of Ruby first by running: `brew install ruby`. 47 | 48 | This will add a line to the `.travis.yml` file that looks like this: 49 | 50 | ```sh 51 | secure: 52 | ``` 53 | 54 | When Travis runs the deployment script, it will decrypt the encrypted value and make it available as a regular environment variable so we can conveniently access the original GITHUB_TOKEN again from within the deployment script. 55 | 56 | That's it! Save and commit the updated `.travis.yml` file. 57 | 58 | ## Deploying manually 59 | 60 | If required, the documentation can also be generated and deployed to GitHub pages from your local machine. 61 | 62 | You need to specify the GITHUB_TOKEN manually like this: 63 | 64 | ```sh 65 | $ GITHUB_TOKEN= ./scripts/deploy_docs_to_gh_pages.sh 66 | ``` 67 | 68 | > **Attention**: It is not recommended to run the deployment script locally if you don't know what you are doing. The scripts is written to run on Travis CI in a VM where code can be deleted without repercussions. Make sure you don't have unsaved work that has not been committed and pushed to GitHub to prevent unwanted code loss in case something goes wrong. 69 | 70 | ## Change log 71 | 72 | #### 2015-03-15 73 | 74 | - added support for commit message filtering 75 | - updated documentation 76 | 77 | #### 2015-03-14 78 | 79 | - added dgeni exception handler 80 | - updated documentation 81 | 82 | #### 2015-03-13 83 | 84 | - initial version 85 | -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/components/phone-detail/phone-detail.html: -------------------------------------------------------------------------------- 1 |
2 | 6 |
7 | 8 |

{{phoneDetail.phone.name}}

9 | 10 |

{{phoneDetail.phone.description}}

11 | 12 |
    13 |
  • 14 | 15 |
  • 16 |
17 | 18 |
    19 |
  • 20 | Availability and Networks 21 |
    22 |
    Availability
    23 |
    {{availability}}
    24 |
    25 |
  • 26 |
  • 27 | Battery 28 |
    29 |
    Type
    30 |
    {{phoneDetail.phone.battery.type}}
    31 |
    Talk Time
    32 |
    {{phoneDetail.phone.battery.talkTime}}
    33 |
    Standby time (max)
    34 |
    {{phoneDetail.phone.battery.standbyTime}}
    35 |
    36 |
  • 37 |
  • 38 | Storage and Memory 39 |
    40 |
    RAM
    41 |
    {{phoneDetail.phone.storage.ram}}
    42 |
    Internal Storage
    43 |
    {{phoneDetail.phone.storage.flash}}
    44 |
    45 |
  • 46 |
  • 47 | Connectivity 48 |
    49 |
    Network Support
    50 |
    {{phoneDetail.phone.connectivity.cell}}
    51 |
    WiFi
    52 |
    {{phoneDetail.phone.connectivity.wifi}}
    53 |
    Bluetooth
    54 |
    {{phoneDetail.phone.connectivity.bluetooth}}
    55 |
    Infrared
    56 |
    {{phoneDetail.phone.connectivity.infrared | checkmark}}
    57 |
    GPS
    58 |
    {{phoneDetail.phone.connectivity.gps | checkmark}}
    59 |
    60 |
  • 61 |
  • 62 | Android 63 |
    64 |
    OS Version
    65 |
    {{phoneDetail.phone.android.os}}
    66 |
    UI
    67 |
    {{phoneDetail.phone.android.ui}}
    68 |
    69 |
  • 70 |
  • 71 | Size and Weight 72 |
    73 |
    Dimensions
    74 |
    {{dim}}
    75 |
    Weight
    76 |
    {{phoneDetail.phone.sizeAndWeight.weight}}
    77 |
    78 |
  • 79 |
  • 80 | Display 81 |
    82 |
    Screen size
    83 |
    {{phoneDetail.phone.display.screenSize}}
    84 |
    Screen resolution
    85 |
    {{phoneDetail.phone.display.screenResolution}}
    86 |
    Touch screen
    87 |
    {{phoneDetail.phone.display.touchScreen | checkmark}}
    88 |
    89 |
  • 90 |
  • 91 | Hardware 92 |
    93 |
    CPU
    94 |
    {{phoneDetail.phone.hardware.cpu}}
    95 |
    USB
    96 |
    {{phoneDetail.phone.hardware.usb}}
    97 |
    Audio / headphone jack
    98 |
    {{phoneDetail.phone.hardware.audioJack}}
    99 |
    FM Radio
    100 |
    {{phoneDetail.phone.hardware.fmRadio | checkmark}}
    101 |
    Accelerometer
    102 |
    {{phoneDetail.phone.hardware.accelerometer | checkmark}}
    103 |
    104 |
  • 105 |
  • 106 | Camera 107 |
    108 |
    Primary
    109 |
    {{phoneDetail.phone.camera.primary}}
    110 |
    Features
    111 |
    {{phoneDetail.phone.camera.features.join(', ')}}
    112 |
    113 |
  • 114 |
  • 115 | Additional Features 116 |
    {{phoneDetail.phone.additionalFeatures}}
    117 |
  • 118 |
119 | -------------------------------------------------------------------------------- /examples/outdated/confirm-unsaved/scenario.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var appRoot = 'examples/angular-1/confirm-unsaved'; 4 | 5 | describe('angular 1.x "Confirm Unsaved" App', function() { 6 | 7 | describe('Index', function () { 8 | beforeEach(function() { 9 | browserGet('index.html'); 10 | }); 11 | 12 | it('should list items', function() { 13 | var items = element.all(by.binding('item.title')); 14 | var first = items.get(0); 15 | expect(first.getText()).toBe('Edit First Post'); 16 | }); 17 | 18 | it('should link items', function() { 19 | var items = element.all(by.binding('item.title')); 20 | var first = items.get(0); 21 | expect(first.getAttribute('href')).toBe('http://0.0.0.0:8000/examples/angular-1/confirm-unsaved/post/1'); 22 | 23 | first.click(); 24 | browser.getLocationAbsUrl().then(function(url) { 25 | expect(url).toBe('/post/1'); 26 | }); 27 | }); 28 | }); 29 | 30 | describe('Edit', function () { 31 | beforeEach(function () { 32 | browserGet('index.html#/post/1'); 33 | }); 34 | 35 | it('should show the initial text', function() { 36 | expect(element(by.model('editPost.newContent')).getAttribute('value')).toBe('I wrote this first.'); 37 | }); 38 | 39 | it('should let you navigate back to the index', function () { 40 | var back = element(by.linkText('Back')); 41 | back.click(); 42 | 43 | browser.getLocationAbsUrl().then(function(url) { 44 | expect(url).toBe('/'); 45 | }); 46 | }) 47 | 48 | it('should prompt you to save if content was changed', function() { 49 | var postContent = element(by.model('editPost.newContent')); 50 | postContent.sendKeys(' Hey!'); 51 | var back = element(by.linkText('Back')); 52 | back.click(); 53 | 54 | browser.getLocationAbsUrl().then(function(url) { 55 | expect(url).toBe('/post/1'); 56 | }); 57 | 58 | expect($('.modal').getText()).toContain('You have unsaved work'); 59 | 60 | element(by.buttonText('Go back and save')).click(); 61 | element(by.buttonText('Save')).click(); 62 | 63 | back.click(); 64 | 65 | browser.getLocationAbsUrl().then(function(url) { 66 | expect(url).toBe('/'); 67 | }); 68 | }); 69 | 70 | it('should let you navigate back without saving', function () { 71 | var postContent = element(by.model('editPost.newContent')); 72 | var previousText = postContent.getText(); 73 | 74 | postContent.sendKeys(' Hey!'); 75 | var back = element(by.linkText('Back')); 76 | back.click(); 77 | 78 | browser.getLocationAbsUrl().then(function(url) { 79 | expect(url).toBe('/post/1'); 80 | }); 81 | 82 | expect($('.modal').getText()).toContain('You have unsaved work'); 83 | 84 | element(by.buttonText('Go back and save')).click(); 85 | element(by.buttonText('Save')).click(); 86 | 87 | back.click(); 88 | 89 | browser.getLocationAbsUrl().then(function(url) { 90 | expect(url).toBe('/'); 91 | }); 92 | }); 93 | 94 | it('should save content if you click "Save"', function () { 95 | element(by.model('editPost.newContent')).sendKeys(' Hey!'); 96 | element(by.buttonText('Save')).click(); 97 | element(by.linkText('Back')).click(); 98 | 99 | browser.getLocationAbsUrl().then(function(url) { 100 | expect(url).toBe('/'); 101 | }); 102 | 103 | element.all(by.binding('item.title')).get(0).click(); 104 | browser.getLocationAbsUrl().then(function(url) { 105 | expect(url).toBe('/post/1'); 106 | }); 107 | 108 | expect(element(by.model('editPost.newContent')).getAttribute('value')).toBe('I wrote this first. Hey!'); 109 | }); 110 | }); 111 | }); 112 | 113 | 114 | function browserGet (url) { 115 | browser.get(appRoot + '/' + url); 116 | } 117 | -------------------------------------------------------------------------------- /shims/angular2/src/facade/collection.js: -------------------------------------------------------------------------------- 1 | exports.List = Array; 2 | exports.Map = Map; 3 | 4 | exports.MapWrapper = { 5 | create: function() { 6 | return new Map(); 7 | }, 8 | 9 | get: function(m, k) { 10 | return m.get(k); 11 | }, 12 | 13 | set: function(m, k, v) { 14 | return m.set(k, v); 15 | }, 16 | 17 | contains: function (m, k) { 18 | return m.has(k); 19 | }, 20 | 21 | forEach: function (m, fn) { 22 | return m.forEach(fn); 23 | } 24 | }; 25 | 26 | exports.StringMapWrapper = { 27 | create: function () { 28 | return {}; 29 | }, 30 | 31 | set: function (m, k, v) { 32 | m[k] = v; 33 | return this; 34 | }, 35 | 36 | get: function (m, k) { 37 | return m.hasOwnProperty(k) ? m[k] : undefined; 38 | }, 39 | 40 | contains: function (m, k) { 41 | return m.hasOwnProperty(k); 42 | }, 43 | 44 | keys: function(map) { 45 | return Object.keys(map); 46 | }, 47 | 48 | isEmpty: function(map) { 49 | for (var prop in map) { 50 | if (map.hasOwnProperty(prop)) { 51 | return false; 52 | } 53 | } 54 | return true; 55 | }, 56 | 57 | delete: function(map, key) { 58 | delete map[key]; 59 | }, 60 | 61 | forEach: function (m, fn) { 62 | for (var prop in m) { 63 | if (m.hasOwnProperty(prop)) { 64 | fn(m[prop], prop); 65 | } 66 | } 67 | }, 68 | 69 | equals: function (m1, m2) { 70 | var k1 = Object.keys(m1); 71 | var k2 = Object.keys(m2); 72 | if (k1.length != k2.length) { 73 | return false; 74 | } 75 | var key; 76 | for (var i = 0; i < k1.length; i++) { 77 | key = k1[i]; 78 | if (m1[key] !== m2[key]) { 79 | return false; 80 | } 81 | } 82 | return true; 83 | }, 84 | 85 | merge: function(m1, m2) { 86 | var attr; 87 | var m = {}; 88 | for (attr in m1) { 89 | if (m1.hasOwnProperty(attr)) { 90 | m[attr] = m1[attr]; 91 | } 92 | } 93 | for (attr in m2) { 94 | if (m2.hasOwnProperty(attr)) { 95 | m[attr] = m2[attr]; 96 | } 97 | } 98 | return m; 99 | } 100 | }; 101 | 102 | exports.ListWrapper = { 103 | toJSON: function(l) { 104 | return JSON.stringify(l); 105 | }, 106 | 107 | clear: function (l) { 108 | l.length = 0; 109 | }, 110 | 111 | create: function () { 112 | return []; 113 | }, 114 | 115 | push: function (l, v) { 116 | return l.push(v); 117 | }, 118 | 119 | forEach: function (l, fn) { 120 | return l.forEach(fn); 121 | }, 122 | 123 | first: function(array) { 124 | if (!array) 125 | return null; 126 | return array[0]; 127 | }, 128 | 129 | last: function(array) { 130 | return (array && array.length) > 0 ? array[array.length - 1] : null; 131 | }, 132 | 133 | map: function (l, fn) { 134 | return l.map(fn); 135 | }, 136 | 137 | join: function (l, str) { 138 | return l.join(str); 139 | }, 140 | 141 | reduce: function(list, fn, init) { 142 | return list.reduce(fn, init); 143 | }, 144 | 145 | filter: function(array, pred) { 146 | return array.filter(pred); 147 | }, 148 | 149 | concat: function(a, b) { 150 | return a.concat(b); 151 | }, 152 | 153 | slice: function(l) { 154 | var from = arguments[1] !== (void 0) ? arguments[1] : 0; 155 | var to = arguments[2] !== (void 0) ? arguments[2] : null; 156 | return l.slice(from, to === null ? undefined : to); 157 | }, 158 | 159 | maximum: function(list, predicate) { 160 | if (list.length === 0) { 161 | return null; 162 | } 163 | var solution = null; 164 | var maxValue = -Infinity; 165 | for (var index = 0; index < list.length; index++) { 166 | var candidate = list[index]; 167 | if (isBlank(candidate)) { 168 | continue; 169 | } 170 | var candidateValue = predicate(candidate); 171 | if (candidateValue > maxValue) { 172 | solution = candidate; 173 | maxValue = candidateValue; 174 | } 175 | } 176 | return solution; 177 | } 178 | }; 179 | 180 | -------------------------------------------------------------------------------- /src/ngComponentRouter.js: -------------------------------------------------------------------------------- 1 | var ngOutlet = require('./ngOutlet'); 2 | var ngLinkDirective = require('./ngLink'); 3 | 4 | var exceptions = require('angular2/src/facade/exceptions'); 5 | var BaseException = exceptions.BaseException; 6 | 7 | var lang = require('angular2/src/facade/lang'); 8 | var isString = lang.isString; 9 | var isPresent = lang.isPresent; 10 | 11 | /* 12 | * A module for adding new a routing system Angular 1. 13 | */ 14 | angular.module('ngComponentRouter', []) 15 | .directive('ngOutlet', ['$animate', '$q', '$rootRouter', ngOutlet.ngOutletDirective]) 16 | .directive('ngOutlet', ['$compile', ngOutlet.ngOutletFillContentDirective]) 17 | .directive('$router', ['$q', ngOutlet.routerTriggerDirective]) 18 | .directive('ngLink', ['$rootRouter', '$parse', ngLinkDirective]) 19 | .provider('$locationHashPrefix', ['$locationProvider', $locationHashPrefixProvider]) 20 | .value('$routerRootComponent', new DummyRootComponent()) 21 | .factory('$rootRouter', ['$q', '$location', '$browser', '$rootScope', '$injector', '$routerRootComponent', '$locationHashPrefix', routerFactory]); 22 | 23 | // Because Angular 1 has no notion of a root component, we use an object with unique identity 24 | // to represent this. Can be overloaded with a component name 25 | function DummyRootComponent() {} 26 | 27 | // Unfortunately, $location doesn't expose what the current hashPrefix is 28 | // So we have to monkey patch the $locationProvider to capture this value 29 | function $locationHashPrefixProvider($locationProvider) { 30 | 31 | // Get hold of the original hashPrefix method 32 | var hashPrefixFn = $locationProvider.hashPrefix.bind($locationProvider); 33 | 34 | // Read the current hashPrefix (in case it was set before this monkey-patch occurred) 35 | var hashPrefix = hashPrefixFn(); 36 | 37 | // Override the helper so that we can read any changes to the prefix (after this monkey-patch) 38 | $locationProvider.hashPrefix = function(prefix) { 39 | if (angular.isDefined(prefix)) { 40 | hashPrefix = prefix; 41 | } 42 | return hashPrefixFn(prefix); 43 | }; 44 | 45 | // Return the final hashPrefix as the value of this service 46 | this.$get = function() { return hashPrefix; }; 47 | } 48 | 49 | function routerFactory($q, $location, $browser, $rootScope, $injector, $routerRootComponent, $locationHashPrefix) { 50 | 51 | // Monkey-patch promises to have access to the $q service 52 | var PromiseWrapper = require('angular2/src/facade/async').PromiseWrapper; 53 | PromiseWrapper.$q = $q; 54 | 55 | // Monkey-patch assertions about the type of the "component" property in a route config 56 | var routeConfigNormalizer = require('./router/route_config/route_config_normalizer'); 57 | routeConfigNormalizer.assertComponentExists = function () {}; 58 | 59 | // Monkey-patch to look for the hook as a static method on the controller class 60 | var routeLifecycleReflector = require('./router/lifecycle/route_lifecycle_reflector'); 61 | routeLifecycleReflector.getCanActivateHook = function(directiveName) { 62 | var $canActivate = getAnnotation(directiveName, '$canActivate'); 63 | return $canActivate && function (next, prev) { 64 | return $injector.invoke($canActivate, null, { 65 | $nextInstruction: next, 66 | $prevInstruction: prev 67 | }); 68 | }; 69 | }; 70 | 71 | // Create the top level router, and its associated registry of router rules 72 | var routeRegistryFactory = require('./router/route_registry_factory'); 73 | var registry = routeRegistryFactory(getAnnotation, $routerRootComponent, $injector); 74 | var Location = require('./router/location/location').Location; 75 | var RootRouter = require('./router/router').RootRouter; 76 | var router = new RootRouter(registry, new Location($location, $rootScope), $routerRootComponent); 77 | 78 | router.subscribe(function (change) { 79 | $rootScope.$broadcast('$routeChangeSuccess', change); 80 | }); 81 | 82 | return router; 83 | 84 | 85 | 86 | function getAnnotation(componentName, annotationName) { 87 | var serviceName = componentName + 'Directive'; 88 | if ($injector.has(serviceName)) { 89 | var definitions = $injector.get(serviceName); 90 | if (definitions.length > 1) { 91 | throw new BaseException('too many directives named "' + componentName + '"'); 92 | } 93 | return definitions[0][annotationName]; 94 | } else { 95 | throw new BaseException('directive "' + componentName + '" is not registered'); 96 | } 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /test/integration/ngRoute_shim_spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('ngRoute shim', function () { 4 | 5 | var elt, 6 | $compile, 7 | $rootScope, 8 | $rootRouter, 9 | $compileProvider, 10 | $routeProvider; 11 | 12 | beforeEach(function () { 13 | module('ng'); 14 | module('ngComponentRouter'); 15 | module('ngRouteShim'); 16 | module(function (_$compileProvider_, _$routeProvider_) { 17 | $compileProvider = _$compileProvider_; 18 | $routeProvider = _$routeProvider_; 19 | }); 20 | 21 | inject(function (_$compile_, _$rootScope_, _$rootRouter_) { 22 | $compile = _$compile_; 23 | $rootScope = _$rootScope_; 24 | $rootRouter = _$rootRouter_; 25 | }); 26 | }); 27 | 28 | it('should work in a simple case', function () { 29 | $routeProvider.when('/', { 30 | controller: function OneController() { 31 | this.number = 'one'; 32 | }, 33 | controllerAs: 'oneCmp', 34 | template: '{{oneCmp.number}}' 35 | }); 36 | 37 | compile(''); 38 | 39 | $rootRouter.navigateByUrl('/'); 40 | $rootScope.$digest(); 41 | 42 | expect(elt.text()).toBe('one'); 43 | }); 44 | 45 | it('should adapt routes with templateUrl', inject(function ($templateCache) { 46 | $routeProvider.when('/', { 47 | controller: function OneController() { 48 | this.number = 'one'; 49 | }, 50 | controllerAs: 'oneCmp', 51 | templateUrl: '/foo' 52 | }); 53 | 54 | $templateCache.put('/foo', [200, '{{oneCmp.number}}', {}]); 55 | 56 | compile('root {}'); 57 | 58 | $rootRouter.navigateByUrl('/'); 59 | $rootScope.$digest(); 60 | expect(elt.text()).toBe('root {one}'); 61 | })); 62 | 63 | it('should adapt routes using the "resolve" option', inject(function ($q) { 64 | $routeProvider.when('/', { 65 | controller: function TestController(resolvedService) { 66 | this.resolvedValue = resolvedService; 67 | }, 68 | controllerAs: 'testCmp', 69 | resolve: { 70 | resolvedService: function () { 71 | return $q.when(42); 72 | } 73 | }, 74 | template: 'value: {{testCmp.resolvedValue}}' 75 | }); 76 | 77 | compile(''); 78 | 79 | $rootRouter.navigateByUrl('/'); 80 | $rootScope.$digest(); 81 | 82 | expect(elt.text()).toBe('value: 42'); 83 | })); 84 | 85 | it('should adapt routes with params', function () { 86 | $routeProvider.when('/user/:name', { 87 | controller: function UserController($routeParams) { 88 | this.$routeParams = $routeParams; 89 | }, 90 | controllerAs: 'userCmp', 91 | template: 'hello {{userCmp.$routeParams.name}}' 92 | }); 93 | $rootScope.$digest(); 94 | 95 | compile(''); 96 | 97 | $rootRouter.navigateByUrl('/user/brian'); 98 | $rootScope.$digest(); 99 | expect(elt.text()).toBe('hello brian'); 100 | 101 | $rootRouter.navigateByUrl('/user/igor'); 102 | $rootScope.$digest(); 103 | expect(elt.text()).toBe('hello igor'); 104 | }); 105 | 106 | it('should adapt routes with wildcard params', function () { 107 | $routeProvider.when('/home/:params*', { 108 | controller: function UserController($routeParams) { 109 | this.$routeParams = $routeParams; 110 | }, 111 | controllerAs: 'homeCmp', 112 | template: 'rest: {{homeCmp.$routeParams.params}}' 113 | }); 114 | $rootScope.$digest(); 115 | 116 | compile(''); 117 | 118 | $rootRouter.navigateByUrl('/home/foo/bar/123'); 119 | $rootScope.$digest(); 120 | expect(elt.text()).toBe('rest: foo/bar/123'); 121 | }); 122 | 123 | it('should warn about and ignore routes with optional params', function () { 124 | spyOn(console, 'warn'); 125 | $routeProvider.when('/home/:params?', { 126 | template: 'home' 127 | }); 128 | $rootScope.$digest(); 129 | 130 | compile('root {}'); 131 | 132 | $rootRouter.navigateByUrl('/home/test'); 133 | $rootScope.$digest(); 134 | expect(elt.text()).toBe('root {}'); 135 | expect(console.warn) 136 | .toHaveBeenCalledWith('Route for "/home/:params?" ignored because it has optional parameters. Skipping.', 137 | '(1 skipped / 0 success / 1 total)'); 138 | }); 139 | 140 | it('should adapt routes with redirects', inject(function ($location) { 141 | $routeProvider 142 | .when('/home', { 143 | template: 'welcome home!', 144 | name: 'Home' 145 | }) 146 | .when('/', { 147 | redirectTo: '/home' 148 | }); 149 | $rootScope.$digest(); 150 | 151 | compile('root {}'); 152 | 153 | $rootRouter.navigateByUrl('/'); 154 | $rootScope.$digest(); 155 | expect(elt.text()).toBe('root {welcome home!}'); 156 | expect($location.path()).toBe('/home'); 157 | })); 158 | 159 | //TODO: this is broken in recognition. un-xit this when https://github.com/angular/angular/issues/4133 is fixed 160 | xit('should adapt "otherwise" routes', inject(function ($location) { 161 | $routeProvider 162 | .when('/home', { 163 | template: 'welcome home!' 164 | }) 165 | .otherwise({ 166 | redirectTo: '/home' 167 | }); 168 | $rootScope.$digest(); 169 | 170 | compile('root {}'); 171 | 172 | $rootRouter.navigateByUrl('/somewhere'); 173 | $rootScope.$digest(); 174 | expect(elt.text()).toBe('root {welcome home!}'); 175 | expect($location.path()).toBe('/home'); 176 | })); 177 | 178 | function compile(template) { 179 | elt = $compile('
' + template + '
')($rootScope); 180 | $rootScope.$digest(); 181 | return elt; 182 | } 183 | }); 184 | -------------------------------------------------------------------------------- /test/integration/router_spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | fdescribe('router', function () { 4 | 5 | function createTestModule() { 6 | var mod = angular.module('testMod', ['ngComponentRouter']) 7 | .value('$routerRootComponent', 'app'); 8 | module('testMod'); 9 | return mod; 10 | } 11 | 12 | it('should work with a provided root component', function() { 13 | createTestModule() 14 | .component('homeCmp', {template: 'Home'}) 15 | .component('otherCmp', {template: 'Other'}) 16 | .component('app', { 17 | template: '
', 18 | $routeConfig: [ 19 | { path: '/home', component: 'homeCmp' }, 20 | { path: '/other', component: 'otherCmp' } 21 | ] 22 | }); 23 | 24 | var elt = compileApp(); 25 | 26 | inject(function($location, $rootScope) { 27 | $location.path('/home'); 28 | $rootScope.$digest(); 29 | expect(elt.text()).toBe('Home'); 30 | 31 | $location.path('/'); 32 | $rootScope.$digest(); 33 | 34 | $location.path('/other'); 35 | $rootScope.$digest(); 36 | expect(elt.text()).toBe('Other'); 37 | 38 | $location.path('/home'); 39 | $rootScope.$digest(); 40 | expect(elt.text()).toBe('Home'); 41 | }); 42 | }); 43 | 44 | it('should bind the component to the current router', function() { 45 | var router; 46 | createTestModule() 47 | .component('homeCmp', { 48 | bindings: { $router: '=' }, 49 | controller: function($scope, $element) { 50 | this.$routerOnActivate = function() { 51 | router = this.$router; 52 | }; 53 | }, 54 | template: 'Home' 55 | }) 56 | .component('app', { 57 | template: '
', 58 | $routeConfig: [ 59 | { path: '/home', component: 'homeCmp' } 60 | ] 61 | }); 62 | 63 | var elt = compileApp(); 64 | 65 | inject(function($location, $rootScope) { 66 | $location.path('/home'); 67 | $rootScope.$digest(); 68 | var homeElement = elt.find('home-cmp'); 69 | expect(homeElement.text()).toBe('Home'); 70 | expect(homeElement.isolateScope().$ctrl.$router).toBeDefined(); 71 | expect(router).toBeDefined(); 72 | }) 73 | }); 74 | 75 | it('should work when an async route is provided route data', function() { 76 | 77 | createTestModule() 78 | 79 | .component('homeCmp', { 80 | template: 'Home ({{$ctrl.isAdmin}})', 81 | controller: function() { 82 | this.$routerOnActivate = function(next, prev) { 83 | this.isAdmin = next.routeData.data.isAdmin; 84 | }; 85 | } 86 | }) 87 | .component('app', { 88 | template: '
', 89 | $routeConfig: [ 90 | { path: '/', loader: function($q) { return $q.when('homeCmp'); }, data: { isAdmin: true } } 91 | ] 92 | }); 93 | 94 | var elt = compileApp(); 95 | 96 | inject(function($location, $rootScope) { 97 | $location.path('/'); 98 | $rootScope.$digest(); 99 | expect(elt.text()).toBe('Home (true)'); 100 | }); 101 | }); 102 | 103 | it('should work with a templateUrl component', function() { 104 | 105 | var $routerOnActivate = jasmine.createSpy('$routerOnActivate'); 106 | 107 | createTestModule() 108 | 109 | .component('homeCmp', { 110 | templateUrl: 'homeCmp.html', 111 | controller: function() { 112 | this.$routerOnActivate = $routerOnActivate; 113 | } 114 | }) 115 | .component('app', { 116 | template: '
', 117 | $routeConfig: [ 118 | { path: '/', component: 'homeCmp' } 119 | ] 120 | }); 121 | 122 | inject(function($location, $rootScope, $httpBackend) { 123 | 124 | $httpBackend.expectGET('homeCmp.html').respond('Home'); 125 | 126 | var elt = compileApp(); 127 | 128 | $location.path('/'); 129 | $rootScope.$digest(); 130 | $httpBackend.flush(); 131 | var homeElement = elt.find('home-cmp'); 132 | expect(homeElement.text()).toBe('Home'); 133 | expect($routerOnActivate).toHaveBeenCalled(); 134 | }) 135 | }); 136 | 137 | it('should provide the current instruction', function() { 138 | createTestModule() 139 | 140 | .component('homeCmp', { 141 | template: 'Home ({{homeCmp.isAdmin}})' 142 | }) 143 | .component('app', { 144 | template: '
', 145 | $routeConfig: [ 146 | { path: '/', component: 'homeCmp', name: 'Home' } 147 | ] 148 | }); 149 | 150 | inject(function($rootScope, $rootRouter, $location) { 151 | var elt = compileApp(); 152 | 153 | $location.path('/'); 154 | $rootScope.$digest(); 155 | var instruction = $rootRouter.generate(['/Home']); 156 | expect($rootRouter.currentInstruction).toEqual(instruction); 157 | }); 158 | }); 159 | 160 | it('should provide the root level router', function() { 161 | createTestModule() 162 | 163 | .component('homeCmp', { 164 | template: 'Home ({{homeCmp.isAdmin}})', 165 | bindings: { 166 | $router: '<' 167 | } 168 | }) 169 | 170 | .component('app', { 171 | template: '
', 172 | $routeConfig: [ 173 | { path: '/', component: 'homeCmp', name: 'Home' } 174 | ] 175 | }); 176 | 177 | 178 | inject(function($rootScope, $rootRouter, $location) { 179 | var elt = compileApp(); 180 | 181 | $location.path('/'); 182 | $rootScope.$digest(); 183 | var homeElement = elt.find('home-cmp'); 184 | expect(homeElement.isolateScope().$ctrl.$router.root).toEqual($rootRouter); 185 | }); 186 | }); 187 | 188 | function compileApp() { 189 | var elt; 190 | inject(function($compile, $rootScope) { 191 | elt = $compile('
')($rootScope); 192 | $rootScope.$digest(); 193 | }); 194 | return elt; 195 | } 196 | }); 197 | -------------------------------------------------------------------------------- /src/ngOutlet.js: -------------------------------------------------------------------------------- 1 | function createOutlet($q, $animate) { 2 | function Outlet(router, scope, element, controller, $transclude) { 3 | this.router = router; 4 | this.scope = scope; 5 | this.element = element; 6 | this.controller = controller; 7 | this.$transclude = $transclude; 8 | } 9 | Outlet.prototype.cleanupLastView = function () { 10 | var _this = this; 11 | if (this.previousLeaveAnimation) { 12 | $animate.cancel(this.previousLeaveAnimation); 13 | this.previousLeaveAnimation = null; 14 | } 15 | if (this.currentScope) { 16 | this.currentScope.$destroy(); 17 | this.currentScope = null; 18 | } 19 | if (this.currentElement) { 20 | this.previousLeaveAnimation = $animate.leave(this.currentElement); 21 | this.previousLeaveAnimation.then(function () { _this.previousLeaveAnimation = null; }); 22 | this.currentElement = null; 23 | } 24 | }; 25 | Outlet.prototype.reuse = function (instruction) { 26 | var next = $q.when(true); 27 | var previousInstruction = this.currentInstruction; 28 | this.currentInstruction = instruction; 29 | if (this.currentController && this.currentController.$routerOnReuse) { 30 | next = $q.when( 31 | this.currentController.$routerOnReuse(this.currentInstruction, previousInstruction)); 32 | } 33 | return next; 34 | }; 35 | Outlet.prototype.routerCanReuse = function (nextInstruction) { 36 | var result; 37 | if (!this.currentInstruction || 38 | this.currentInstruction.componentType !== nextInstruction.componentType) { 39 | result = false; 40 | } 41 | else if (this.currentController && this.currentController.$routerCanReuse) { 42 | result = this.currentController.$routerCanReuse(nextInstruction, this.currentInstruction); 43 | } 44 | else { 45 | result = nextInstruction === this.currentInstruction || 46 | angular.equals(nextInstruction.params, this.currentInstruction.params); 47 | } 48 | return $q.when(result); 49 | }; 50 | Outlet.prototype.routerCanDeactivate = function (instruction) { 51 | if (this.currentController && this.currentController.$routerCanDeactivate) { 52 | return $q.when( 53 | this.currentController.$routerCanDeactivate(instruction, this.currentInstruction)); 54 | } 55 | return $q.when(true); 56 | }; 57 | Outlet.prototype.deactivate = function (instruction) { 58 | if (this.currentController && this.currentController.$routerOnDeactivate) { 59 | return $q.when( 60 | this.currentController.$routerOnDeactivate(instruction, this.currentInstruction)); 61 | } 62 | return $q.when(); 63 | }; 64 | Outlet.prototype.activate = function (instruction) { 65 | var _this = this; 66 | this.previousInstruction = this.currentInstruction; 67 | this.currentInstruction = instruction; 68 | var componentName = this.controller.$$componentName = instruction.componentType; 69 | if (typeof componentName !== 'string') { 70 | throw new Error('Component is not a string for ' + instruction.urlPath); 71 | } 72 | this.controller.$$template = '<' + dashCase(componentName) + ' $router="::$$router">'; 74 | this.controller.$$router = this.router.childRouter(instruction.componentType); 75 | this.controller.$$outlet = this; 76 | var newScope = this.scope.$new(); 77 | newScope.$$router = this.controller.$$router; 78 | this.deferredActivation = $q.defer(); 79 | var clone = this.$transclude(newScope, function (clone) { 80 | $animate.enter(clone, null, _this.currentElement || _this.element); 81 | _this.cleanupLastView(); 82 | }); 83 | this.currentElement = clone; 84 | this.currentScope = newScope; 85 | return this.deferredActivation.promise; 86 | }; 87 | return Outlet; 88 | } 89 | 90 | /** 91 | * @name ngOutlet 92 | * 93 | * @description 94 | * An ngOutlet is where resolved content goes. 95 | * 96 | * ## Use 97 | * 98 | * ```html 99 | *
100 | * ``` 101 | * 102 | * The value for the `ngOutlet` attribute is optional. 103 | */ 104 | exports.ngOutletDirective = function($animate, $q, $rootRouter) { 105 | var Outlet = createOutlet($q, $animate); 106 | var rootRouter = $rootRouter; 107 | 108 | return { 109 | restrict: 'AE', 110 | transclude: 'element', 111 | terminal: true, 112 | priority: 400, 113 | require: ['?^^ngOutlet', 'ngOutlet'], 114 | link: function outletLink(scope, element, attrs, ctrls, $transclude) { 115 | var parentCtrl = ctrls[0], myCtrl = ctrls[1], 116 | router = (parentCtrl && parentCtrl.$$router) || rootRouter; 117 | myCtrl.$$currentComponent = null; 118 | router.registerPrimaryOutlet(new Outlet(router, scope, element, myCtrl, $transclude)); 119 | }, 120 | controller: function() {}, 121 | controllerAs: '$$ngOutlet' 122 | }; 123 | }; 124 | 125 | /** 126 | * This directive is responsible for compiling the contents of ng-outlet 127 | */ 128 | exports.ngOutletFillContentDirective = function($compile) { 129 | return { 130 | restrict: 'EA', 131 | priority: -400, 132 | require: 'ngOutlet', 133 | link: function(scope, element, attrs, ctrl) { 134 | var template = ctrl.$$template; 135 | element.html(template); 136 | $compile(element.contents())(scope); 137 | } 138 | }; 139 | }; 140 | 141 | 142 | 143 | exports.routerTriggerDirective = function($q) { 144 | return { 145 | require: '^ngOutlet', 146 | priority: -1000, 147 | link: function(scope, element, attr, ngOutletCtrl) { 148 | var promise = $q.when(); 149 | var outlet = ngOutletCtrl.$$outlet; 150 | var currentComponent = outlet.currentController = 151 | element.controller(ngOutletCtrl.$$componentName); 152 | if (currentComponent.$routerOnActivate) { 153 | promise = $q.when(currentComponent.$routerOnActivate(outlet.currentInstruction, 154 | outlet.previousInstruction)); 155 | } 156 | promise.then(outlet.deferredActivation.resolve, outlet.deferredActivation.reject); 157 | } 158 | }; 159 | }; 160 | 161 | function dashCase(str) { 162 | return str.replace(/[A-Z]/g, function(match) { return '-' + match.toLowerCase(); }); 163 | } -------------------------------------------------------------------------------- /examples/outdated/phone-kitten/phones/phones.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "age": 0, 4 | "id": "motorola-xoom-with-wi-fi", 5 | "imageUrl": "img/phones/motorola-xoom-with-wi-fi.0.jpg", 6 | "name": "Motorola XOOM\u2122 with Wi-Fi", 7 | "snippet": "The Next, Next Generation\r\n\r\nExperience the future with Motorola XOOM with Wi-Fi, the world's first tablet powered by Android 3.0 (Honeycomb)." 8 | }, 9 | { 10 | "age": 1, 11 | "id": "motorola-xoom", 12 | "imageUrl": "img/phones/motorola-xoom.0.jpg", 13 | "name": "MOTOROLA XOOM\u2122", 14 | "snippet": "The Next, Next Generation\n\nExperience the future with MOTOROLA XOOM, the world's first tablet powered by Android 3.0 (Honeycomb)." 15 | }, 16 | { 17 | "age": 2, 18 | "carrier": "AT&T", 19 | "id": "motorola-atrix-4g", 20 | "imageUrl": "img/phones/motorola-atrix-4g.0.jpg", 21 | "name": "MOTOROLA ATRIX\u2122 4G", 22 | "snippet": "MOTOROLA ATRIX 4G the world's most powerful smartphone." 23 | }, 24 | { 25 | "age": 3, 26 | "id": "dell-streak-7", 27 | "imageUrl": "img/phones/dell-streak-7.0.jpg", 28 | "name": "Dell Streak 7", 29 | "snippet": "Introducing Dell\u2122 Streak 7. Share photos, videos and movies together. It\u2019s small enough to carry around, big enough to gather around." 30 | }, 31 | { 32 | "age": 4, 33 | "carrier": "Cellular South", 34 | "id": "samsung-gem", 35 | "imageUrl": "img/phones/samsung-gem.0.jpg", 36 | "name": "Samsung Gem\u2122", 37 | "snippet": "The Samsung Gem\u2122 brings you everything that you would expect and more from a touch display smart phone \u2013 more apps, more features and a more affordable price." 38 | }, 39 | { 40 | "age": 5, 41 | "carrier": "Dell", 42 | "id": "dell-venue", 43 | "imageUrl": "img/phones/dell-venue.0.jpg", 44 | "name": "Dell Venue", 45 | "snippet": "The Dell Venue; Your Personal Express Lane to Everything" 46 | }, 47 | { 48 | "age": 6, 49 | "carrier": "Best Buy", 50 | "id": "nexus-s", 51 | "imageUrl": "img/phones/nexus-s.0.jpg", 52 | "name": "Nexus S", 53 | "snippet": "Fast just got faster with Nexus S. A pure Google experience, Nexus S is the first phone to run Gingerbread (Android 2.3), the fastest version of Android yet." 54 | }, 55 | { 56 | "age": 7, 57 | "carrier": "Cellular South", 58 | "id": "lg-axis", 59 | "imageUrl": "img/phones/lg-axis.0.jpg", 60 | "name": "LG Axis", 61 | "snippet": "Android Powered, Google Maps Navigation, 5 Customizable Home Screens" 62 | }, 63 | { 64 | "age": 8, 65 | "id": "samsung-galaxy-tab", 66 | "imageUrl": "img/phones/samsung-galaxy-tab.0.jpg", 67 | "name": "Samsung Galaxy Tab\u2122", 68 | "snippet": "Feel Free to Tab\u2122. The Samsung Galaxy Tab\u2122 brings you an ultra-mobile entertainment experience through its 7\u201d display, high-power processor and Adobe\u00ae Flash\u00ae Player compatibility." 69 | }, 70 | { 71 | "age": 9, 72 | "carrier": "Cellular South", 73 | "id": "samsung-showcase-a-galaxy-s-phone", 74 | "imageUrl": "img/phones/samsung-showcase-a-galaxy-s-phone.0.jpg", 75 | "name": "Samsung Showcase\u2122 a Galaxy S\u2122 phone", 76 | "snippet": "The Samsung Showcase\u2122 delivers a cinema quality experience like you\u2019ve never seen before. Its innovative 4\u201d touch display technology provides rich picture brilliance, even outdoors" 77 | }, 78 | { 79 | "age": 10, 80 | "carrier": "Verizon", 81 | "id": "droid-2-global-by-motorola", 82 | "imageUrl": "img/phones/droid-2-global-by-motorola.0.jpg", 83 | "name": "DROID\u2122 2 Global by Motorola", 84 | "snippet": "The first smartphone with a 1.2 GHz processor and global capabilities." 85 | }, 86 | { 87 | "age": 11, 88 | "carrier": "Verizon", 89 | "id": "droid-pro-by-motorola", 90 | "imageUrl": "img/phones/droid-pro-by-motorola.0.jpg", 91 | "name": "DROID\u2122 Pro by Motorola", 92 | "snippet": "The next generation of DOES." 93 | }, 94 | { 95 | "age": 12, 96 | "carrier": "AT&T", 97 | "id": "motorola-bravo-with-motoblur", 98 | "imageUrl": "img/phones/motorola-bravo-with-motoblur.0.jpg", 99 | "name": "MOTOROLA BRAVO\u2122 with MOTOBLUR\u2122", 100 | "snippet": "An experience to cheer about." 101 | }, 102 | { 103 | "age": 13, 104 | "carrier": "T-Mobile", 105 | "id": "motorola-defy-with-motoblur", 106 | "imageUrl": "img/phones/motorola-defy-with-motoblur.0.jpg", 107 | "name": "Motorola DEFY\u2122 with MOTOBLUR\u2122", 108 | "snippet": "Are you ready for everything life throws your way?" 109 | }, 110 | { 111 | "age": 14, 112 | "carrier": "T-Mobile", 113 | "id": "t-mobile-mytouch-4g", 114 | "imageUrl": "img/phones/t-mobile-mytouch-4g.0.jpg", 115 | "name": "T-Mobile myTouch 4G", 116 | "snippet": "The T-Mobile myTouch 4G is a premium smartphone designed to deliver blazing fast 4G speeds so that you can video chat from practically anywhere, with or without Wi-Fi." 117 | }, 118 | { 119 | "age": 15, 120 | "carrier": "US Cellular", 121 | "id": "samsung-mesmerize-a-galaxy-s-phone", 122 | "imageUrl": "img/phones/samsung-mesmerize-a-galaxy-s-phone.0.jpg", 123 | "name": "Samsung Mesmerize\u2122 a Galaxy S\u2122 phone", 124 | "snippet": "The Samsung Mesmerize\u2122 delivers a cinema quality experience like you\u2019ve never seen before. Its innovative 4\u201d touch display technology provides rich picture brilliance,even outdoors" 125 | }, 126 | { 127 | "age": 16, 128 | "carrier": "Sprint", 129 | "id": "sanyo-zio", 130 | "imageUrl": "img/phones/sanyo-zio.0.jpg", 131 | "name": "SANYO ZIO", 132 | "snippet": "The Sanyo Zio by Kyocera is an Android smartphone with a combination of ultra-sleek styling, strong performance and unprecedented value." 133 | }, 134 | { 135 | "age": 17, 136 | "id": "samsung-transform", 137 | "imageUrl": "img/phones/samsung-transform.0.jpg", 138 | "name": "Samsung Transform\u2122", 139 | "snippet": "The Samsung Transform\u2122 brings you a fun way to customize your Android powered touch screen phone to just the way you like it through your favorite themed \u201cSprint ID Service Pack\u201d." 140 | }, 141 | { 142 | "age": 18, 143 | "id": "t-mobile-g2", 144 | "imageUrl": "img/phones/t-mobile-g2.0.jpg", 145 | "name": "T-Mobile G2", 146 | "snippet": "The T-Mobile G2 with Google is the first smartphone built for 4G speeds on T-Mobile's new network. Get the information you need, faster than you ever thought possible." 147 | }, 148 | { 149 | "age": 19, 150 | "id": "motorola-charm-with-motoblur", 151 | "imageUrl": "img/phones/motorola-charm-with-motoblur.0.jpg", 152 | "name": "Motorola CHARM\u2122 with MOTOBLUR\u2122", 153 | "snippet": "Motorola CHARM fits easily in your pocket or palm. Includes MOTOBLUR service." 154 | } 155 | ] 156 | -------------------------------------------------------------------------------- /test/ng_link_spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('ngLink', function () { 4 | 5 | describe('html5Mode enabled', function () { 6 | runHrefTestsAndExpectPrefix('/', true); 7 | }); 8 | 9 | describe('html5Mode disabled', function () { 10 | runHrefTestsAndExpectPrefix('', false, ''); 11 | }); 12 | 13 | describe('html5Mode disabled, with hash prefix', function () { 14 | runHrefTestsAndExpectPrefix('', false, '!'); 15 | }); 16 | 17 | describe('html5Mode enabled', function () { 18 | runHrefTestsAndExpectPrefix('/moo', true); 19 | }); 20 | 21 | describe('html5Mode disabled', function () { 22 | runHrefTestsAndExpectPrefix('/moo', false, ''); 23 | }); 24 | 25 | describe('html5Mode disabled, with hash prefix', function () { 26 | runHrefTestsAndExpectPrefix('/moo', false, '!'); 27 | }); 28 | 29 | function runHrefTestsAndExpectPrefix(baseHref, html5Mode, hashPrefix) { 30 | var prefix = html5Mode ? '.' : '#' + hashPrefix; 31 | 32 | it('should allow linking from the parent to the child', function () { 33 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 34 | configureRouter([ 35 | { path: '/a', component: 'oneCmp' }, 36 | { path: '/b', component: 'twoCmp', name: 'Two' } 37 | ]); 38 | 39 | var elt = compile('link | outer {
}'); 40 | navigateTo('/a'); 41 | expect(elt.find('a').attr('href')).toBe(prefix + '/b'); 42 | }); 43 | 44 | it('should allow linking from the child and the parent', function () { 45 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 46 | configureRouter([ 47 | { path: '/a', component: 'oneCmp' }, 48 | { path: '/b', component: 'twoCmp', name: 'Two' } 49 | ]); 50 | 51 | var elt = compile('outer {
}'); 52 | navigateTo('/b'); 53 | expect(elt.find('a').attr('href')).toBe(prefix + '/b'); 54 | }); 55 | 56 | 57 | it('should allow params in routerLink directive', function () { 58 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 59 | registerComponent('twoLinkCmp', '', function () {this.number = 'two'}); 60 | configureRouter([ 61 | { path: '/a', component: 'twoLinkCmp' }, 62 | { path: '/b/:param', component: 'twoCmp', name: 'Two' } 63 | ]); 64 | 65 | var elt = compile('
'); 66 | navigateTo('/a'); 67 | expect(elt.find('a').attr('href')).toBe(prefix + '/b/lol'); 68 | }); 69 | 70 | 71 | it('should update the href of links with bound params', function () { 72 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 73 | registerComponent('twoLinkCmp', '', function () {this.number = 43}); 74 | configureRouter([ 75 | { path: '/a', component: 'twoLinkCmp' }, 76 | { path: '/b/:param', component: 'twoCmp', name: 'Two' } 77 | ]); 78 | 79 | var elt = compile('
'); 80 | navigateTo('/a'); 81 | expect(elt.find('a').text()).toBe('43'); 82 | expect(elt.find('a').attr('href')).toBe(prefix + '/b/43'); 83 | }); 84 | 85 | 86 | it('should navigate on left-mouse click when a link url matches a route', function () { 87 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 88 | configureRouter([ 89 | { path: '/', component: 'oneCmp' }, 90 | { path: '/two', component: 'twoCmp', name: 'Two'} 91 | ]); 92 | 93 | var elt = compile('link |
'); 94 | expect(elt.text()).toBe('link | one'); 95 | expect(elt.find('a').attr('href')).toBe(prefix + '/two'); 96 | 97 | elt.find('a')[0].click(); 98 | inject(function($rootScope) { $rootScope.$digest(); }); 99 | expect(elt.text()).toBe('link | two'); 100 | }); 101 | 102 | 103 | it('should not navigate on non-left mouse click when a link url matches a route', function() { 104 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 105 | configureRouter([ 106 | { path: '/', component: 'oneCmp' }, 107 | { path: '/two', component: 'twoCmp', name: 'Two'} 108 | ]); 109 | 110 | var elt = compile('link |
'); 111 | expect(elt.text()).toBe('link | one'); 112 | elt.find('a').triggerHandler({ type: 'click', which: 3 }); 113 | inject(function($rootScope) { $rootScope.$digest(); }); 114 | expect(elt.text()).toBe('link | one'); 115 | }); 116 | 117 | 118 | // See https://github.com/angular/router/issues/206 119 | it('should not navigate a link without an href', function () { 120 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 121 | configureRouter([ 122 | { path: '/', component: 'oneCmp' }, 123 | { path: '/two', component: 'twoCmp', name: 'Two'} 124 | ]); 125 | expect(function () { 126 | var elt = compile('link'); 127 | expect(elt.text()).toBe('link'); 128 | elt.find('a')[0].click(); 129 | inject(function($rootScope) { $rootScope.$digest(); }); 130 | }).not.toThrow(); 131 | }); 132 | 133 | it('should add an ng-link-active class on the current link', function() { 134 | setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix}); 135 | configureRouter([ 136 | { path: '/', component: 'oneCmp', name: 'One' } 137 | ]); 138 | 139 | var elt = compile('one |
'); 140 | navigateTo('/'); 141 | expect(elt.find('a').attr('class')).toBe('ng-link-active'); 142 | }); 143 | } 144 | 145 | function registerComponent(name, template, controller) { 146 | module(function($compileProvider) { 147 | $compileProvider.component(name, { 148 | template: template, 149 | controller: controller 150 | }); 151 | }); 152 | } 153 | 154 | function setup(config) { 155 | module(function($provide) { 156 | $provide.decorator('$browser', function($delegate) { 157 | $delegate.baseHref = function() { return config.baseHref; }; 158 | return $delegate; 159 | }); 160 | }); 161 | module('ngComponentRouter'); 162 | module(function($locationProvider) { 163 | $locationProvider.html5Mode(config.html5Mode); 164 | $locationProvider.hashPrefix(config.hashPrefix); 165 | }); 166 | registerComponent('userCmp', '
hello {{$ctrl.$routeParams.name}}
', function () {}); 167 | registerComponent('oneCmp', '
{{$ctrl.number}}
', function () {this.number = 'one'}); 168 | registerComponent('twoCmp', '', function () {this.number = 'two'}); 169 | } 170 | 171 | function configureRouter(routeConfig) { 172 | inject(function($rootRouter) { 173 | $rootRouter.config(routeConfig); 174 | }); 175 | } 176 | 177 | function compile(template) { 178 | var elt; 179 | inject(function($compile, $rootScope) { 180 | elt = $compile('
' + template + '
')($rootScope); 181 | $rootScope.$digest(); 182 | }); 183 | return elt; 184 | } 185 | 186 | function navigateTo(url) { 187 | inject(function($rootRouter, $rootScope) { 188 | $rootRouter.navigateByUrl(url); 189 | $rootScope.$digest(); 190 | }); 191 | } 192 | }); 193 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Angular 1 Component Router 2 | 3 | We'd love for you to contribute to our source code and to make the Angular 1 Component Router even 4 | better than it is today! 5 | 6 | Remember that this is only for the Angular 1 Component Router. If you have issues with the Angular 2 7 | version of the Component Router then see the [Angular 2 repository][angular2] 8 | 9 | Here are the guidelines we'd like you to follow: 10 | 11 | - [Code of Conduct](#coc) 12 | - [Issue, Question or Problem?](#question) 13 | - [Feature Requests](#feature) 14 | - [Submission Guidelines](#submit) 15 | - [Coding Rules](#rules) 16 | - [Commit Message Guidelines](#commit) 17 | - [Signing the CLA](#cla) 18 | 19 | ## Code of Conduct 20 | Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][coc]. 21 | 22 | ## Got an Issue, Question or Problem? 23 | 24 | If you find a bug in the source code or a mistake in the documentation, you can help us by 25 | submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request 26 | with a fix. 27 | 28 | **Please see the Submission Guidelines below**. 29 | 30 | ## Want a Feature? 31 | You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you 32 | would like to implement a new feature then consider what kind of change it is: 33 | 34 | 35 | ## Submission Guidelines 36 | 37 | ### Submitting an Issue 38 | Before you submit your issue search the [archive][issues], maybe your question was already answered. 39 | 40 | If your issue appears to be a bug, and hasn't been reported, open a new issue. 41 | Help us to maximize the effort we can spend fixing issues and adding new 42 | features, by not reporting duplicate issues. Providing the following information will increase the 43 | chances of your issue being dealt with quickly: 44 | 45 | * **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps 46 | * **Motivation for or Use Case** - explain why this is a bug for you 47 | * **Angular Version(s)** - is it a regression? 48 | * **Browsers and Operating System** - is this a problem with all browsers or only IE8? 49 | * **Reproduce the Error** - provide a live example (using [Plunker][plunker] or 50 | [JSFiddle][jsfiddle]) or an unambiguous set of steps. 51 | * **Related Issues** - has a similar issue been reported before? 52 | * **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be 53 | causing the problem (line of code or commit) 54 | 55 | Here is a great example of a well defined issue: https://github.com/angular/angular.js/issues/5069 56 | 57 | **If you get help, help others. Good karma rulez!** 58 | 59 | ### Submitting a Pull Request 60 | Before you submit your pull request consider the following guidelines: 61 | 62 | * Search [GitHub][pulls] for an open or closed Pull Request 63 | that relates to your submission. You don't want to duplicate effort. 64 | * Please sign our [Contributor License Agreement (CLA)](#cla) before sending pull 65 | requests. We cannot accept code without this. 66 | * Make your changes in a new git branch: 67 | 68 | ```shell 69 | git checkout -b my-fix-branch master 70 | ``` 71 | 72 | * Create your patch, **including appropriate test cases**. 73 | * Follow our [Coding Rules](#rules). 74 | * Run the full test suite and ensure that all tests pass. 75 | * Commit your changes using a descriptive commit message that follows our 76 | [commit message conventions](#commit-message-format) and passes our commit message presubmit hook 77 | `validate-commit-msg.js`. Adherence to the [commit message conventions](#commit-message-format) 78 | is required because release notes are automatically generated from these messages. 79 | 80 | ```shell 81 | git commit -a 82 | ``` 83 | Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files. 84 | 85 | * Push your branch to GitHub: 86 | 87 | ```shell 88 | git push origin my-fix-branch 89 | ``` 90 | 91 | * In GitHub, send a pull request to the `master` branch. 92 | * If we suggest changes then: 93 | * Make the required updates. 94 | * Re-run the Angular test suite to ensure tests are still passing. 95 | * Commit your changes to your branch (e.g. `my-fix-branch`). 96 | * Push the changes to your GitHub repository (this will update your Pull Request). 97 | 98 | If the PR gets too outdated we may ask you to rebase and force push to update the PR: 99 | 100 | ```shell 101 | git rebase master -i 102 | git push origin my-fix-branch -f 103 | ``` 104 | 105 | *WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments 106 | on code that were previously made by you and others in your commits.* 107 | 108 | That's it! Thank you for your contribution! 109 | 110 | #### After your pull request is merged 111 | 112 | After your pull request is merged, you can safely delete your branch and pull the changes 113 | from the main (upstream) repository: 114 | 115 | * Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: 116 | 117 | ```shell 118 | git push origin --delete my-fix-branch 119 | ``` 120 | 121 | * Check out the master branch: 122 | 123 | ```shell 124 | git checkout master -f 125 | ``` 126 | 127 | * Delete the local branch: 128 | 129 | ```shell 130 | git branch -D my-fix-branch 131 | ``` 132 | 133 | * Update your master with the latest upstream version: 134 | 135 | ```shell 136 | git pull --ff upstream master 137 | ``` 138 | 139 | ## Coding Rules 140 | To ensure consistency throughout the source code, keep these rules in mind as you are working: 141 | 142 | * All features or bug fixes **must be tested** by one or more specs. 143 | * All public API methods **must be documented** with a jsdoc style comment block. 144 | 145 | ## Git Commit Guidelines 146 | 147 | We have very precise rules over how our git commit messages can be formatted. This leads to **more 148 | readable messages** that are easy to follow when looking through the **project history**. But also, 149 | we use the git commit messages to **generate the AngularJS change log**. 150 | 151 | The commit message formatting can be added using a typical git workflow or through the use of a CLI wizard 152 | ([Commitizen](https://github.com/commitizen/cz-cli)). To use the wizard, run `npm run commit` in your terminal 153 | after staging your changes in git. 154 | 155 | ### Commit Message Format 156 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 157 | format that includes a **type**, a **scope** and a **subject**: 158 | 159 | ``` 160 | (): 161 | 162 | 163 | 164 |