├── docs ├── content │ ├── notes │ │ └── empty.tmp │ ├── error │ │ ├── animate │ │ │ └── notcsel.ngdoc │ │ ├── interpolate │ │ │ ├── interr.ngdoc │ │ │ └── noconcat.ngdoc │ │ ├── jqLite │ │ │ ├── offargs.ngdoc │ │ │ ├── onargs.ngdoc │ │ │ └── nosel.ngdoc │ │ ├── sce │ │ │ ├── itype.ngdoc │ │ │ ├── icontext.ngdoc │ │ │ ├── imatcher.ngdoc │ │ │ ├── iwcard.ngdoc │ │ │ ├── unsafe.ngdoc │ │ │ ├── iequirks.ngdoc │ │ │ └── insecurl.ngdoc │ │ ├── ng │ │ │ ├── areq.ngdoc │ │ │ ├── badname.ngdoc │ │ │ ├── cpi.ngdoc │ │ │ ├── cpws.ngdoc │ │ │ └── btstrpd.ngdoc │ │ ├── cacheFactory │ │ │ └── iid.ngdoc │ │ ├── resource │ │ │ ├── badname.ngdoc │ │ │ ├── badargs.ngdoc │ │ │ ├── badcfg.ngdoc │ │ │ └── badmember.ngdoc │ │ ├── ngPattern │ │ │ └── noregexp.ngdoc │ │ ├── parse │ │ │ ├── lexerr.ngdoc │ │ │ ├── ueoe.ngdoc │ │ │ ├── isecfn.ngdoc │ │ │ ├── syntax.ngdoc │ │ │ ├── isecfld.ngdoc │ │ │ ├── isecdom.ngdoc │ │ │ └── isecwindow.ngdoc │ │ ├── location │ │ │ ├── isrcharg.ngdoc │ │ │ ├── ipthprfx.ngdoc │ │ │ └── ihshprfx.ngdoc │ │ ├── injector │ │ │ ├── modulerr.ngdoc │ │ │ ├── pget.ngdoc │ │ │ ├── unpr.ngdoc │ │ │ ├── cdep.ngdoc │ │ │ ├── itkn.ngdoc │ │ │ └── nomod.ngdoc │ │ ├── ngOptions │ │ │ └── iexp.ngdoc │ │ ├── index.ngdoc │ │ ├── sanitize │ │ │ └── badparse.ngdoc │ │ ├── ngTransclude │ │ │ └── orphan.ngdoc │ │ ├── compile │ │ │ ├── tpload.ngdoc │ │ │ ├── multidir.ngdoc │ │ │ ├── iscp.ngdoc │ │ │ ├── nodomevents.ngdoc │ │ │ ├── selmulti.ngdoc │ │ │ ├── uterdir.ngdoc │ │ │ ├── nonassign.ngdoc │ │ │ ├── tplrt.ngdoc │ │ │ └── ctreq.ngdoc │ │ ├── controller │ │ │ └── noscp.ngdoc │ │ ├── ngRepeat │ │ │ ├── iexp.ngdoc │ │ │ ├── iidexp.ngdoc │ │ │ └── dupes.ngdoc │ │ ├── rootScope │ │ │ └── infdig.ngdoc │ │ └── ngModel │ │ │ └── nonassign.ngdoc │ ├── api │ │ └── ng.ngdoc │ ├── guide │ │ ├── dev_guide.services.ngdoc │ │ ├── dev_guide.templates.css-styling.ngdoc │ │ └── dev_guide.services.testing_services.ngdoc │ ├── tutorial │ │ ├── the_end.ngdoc │ │ └── step_01.ngdoc │ └── cookbook │ │ └── helloworld.ngdoc ├── img │ ├── bullet.png │ ├── helloworld.png │ ├── AngularJS-small.png │ ├── angular_parts.png │ ├── form_data_flow.png │ ├── helloworld_2way.png │ ├── One_Way_Data_Binding.png │ ├── Two_Way_Data_Binding.png │ ├── glyphicons-halflings.png │ ├── guide │ │ ├── concepts-scope.png │ │ ├── concepts-view.png │ │ ├── concepts-runtime.png │ │ ├── concepts-startup.png │ │ ├── dom_scope_final.png │ │ ├── scenario_runner.png │ │ ├── concepts-directive.png │ │ ├── di_sequence_final.png │ │ ├── simple_scope_final.png │ │ ├── concepts-databinding1.png │ │ ├── concepts-databinding2.png │ │ ├── concepts-module-injector.png │ │ ├── concepts-module-service.png │ │ └── hashbang_vs_regular_url.jpg │ ├── tutorial │ │ ├── tutorial_00.png │ │ ├── tutorial_02.png │ │ ├── tutorial_03.png │ │ ├── tutorial_04.png │ │ ├── catalog_screen.png │ │ ├── tutorial_00_final.png │ │ ├── tutorial_07_final.png │ │ ├── xhr_service_final.png │ │ ├── tutorial_08-09_final.png │ │ └── tutorial_10-11_final.png │ └── glyphicons-halflings-white.png ├── src │ ├── templates │ │ ├── favicon.ico │ │ ├── offline.html │ │ ├── .htaccess │ │ ├── docs-scenario.html │ │ └── css │ │ │ ├── animations.css │ │ │ └── prettify.css │ └── SiteMap.js ├── spec │ ├── sitemapSpec.js │ ├── specs.js │ └── sourceLinkSpec.js └── component-spec │ ├── versionJumpSpec.js │ ├── mocks.js │ └── syntaxSpec.js ├── logs └── .gitignore ├── example ├── view1.html ├── view2.html ├── index.html ├── personalLog │ ├── scenario │ │ └── runner.html │ └── personalLog.html ├── temp.html ├── tweeter │ ├── tweeterclient.js │ ├── style.css │ └── tweeter_demo.html └── buzz │ └── buzz.js ├── src ├── module.suffix ├── publishExternalApis.js ├── ng │ ├── directive │ │ ├── style.js │ │ ├── directives.js │ │ ├── ngNonBindable.js │ │ ├── a.js │ │ ├── ngStyle.js │ │ ├── ngCsp.js │ │ └── ngInit.js │ ├── document.js │ ├── rootElement.js │ ├── exceptionHandler.js │ └── window.js ├── loader.prefix ├── module.prefix ├── angular.prefix ├── ngScenario │ ├── angular.prefix │ ├── output │ │ ├── Object.js │ │ ├── Json.js │ │ └── Xml.js │ ├── angular.suffix │ ├── .jshintrc │ ├── matchers.js │ └── Future.js ├── angular.suffix ├── ngCookies │ └── .jshintrc ├── ngResource │ └── .jshintrc ├── ngTouch │ ├── .jshintrc │ └── touch.js ├── ngRoute │ ├── .jshintrc │ └── routeParams.js ├── ngSanitize │ └── .jshintrc ├── ngAnimate │ └── .jshintrc ├── ngMock │ └── .jshintrc ├── loader.suffix ├── ngLocale │ └── .jshintrc └── apis.js ├── lib ├── browser-stack │ ├── start-tunnel.sh │ └── start-tunnel.js ├── promises-aplus │ └── promises-aplus-test-adapter.js └── sauce │ └── sauce_connect_setup.sh ├── .bowerrc ├── images ├── favicon.ico ├── css │ ├── arrow_left.gif │ ├── arrow_right.gif │ └── indicator-wait.png ├── docs │ ├── Diagrams.graffle │ │ ├── image1.png │ │ ├── image2.png │ │ ├── image4.png │ │ ├── image8.png │ │ ├── image9.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ ├── guide │ │ ├── concepts.graffle │ │ │ ├── image1.png │ │ │ ├── image4.png │ │ │ └── image5.png │ │ └── simple_scope.graffle │ │ │ ├── image7.png │ │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ └── tutorial │ │ ├── simple_scope.graffle │ │ ├── image7.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ ├── tutorial_02.graffle │ │ ├── image11.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ ├── tutorial_03.graffle │ │ ├── image13.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ ├── tutorial_04.graffle │ │ ├── image15.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ ├── tutorial_07.graffle │ │ ├── image9.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ ├── tutorial_08-09.graffle │ │ ├── image10.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ ├── tutorial_10-11.graffle │ │ ├── image10.png │ │ └── QuickLook │ │ │ ├── Preview.pdf │ │ │ └── Thumbnail.tiff │ │ └── tutorial_proto.graffle │ │ ├── image7.png │ │ └── QuickLook │ │ ├── Preview.pdf │ │ └── Thumbnail.tiff └── logo │ ├── AngularJS.graffle │ ├── data.plist │ ├── image1.png │ └── image2.png │ ├── AngularJS.exports │ ├── AngularJS.pdf │ ├── AngularJS-huge.png │ ├── AngularJS-large.png │ ├── AngularJS-medium.png │ └── AngularJS-small.png │ └── AngularJS-Shield.exports │ ├── AngularJS-Shield.pdf │ ├── AngularJS-Shield-huge.png │ ├── AngularJS-Shield-large.png │ ├── AngularJS-Shield-small.png │ └── AngularJS-Shield-medium.png ├── test ├── jquery_alias.js ├── jquery_remove.js ├── ngScenario │ ├── e2e │ │ ├── style.css │ │ ├── Runner-compiled.html │ │ └── Runner.html │ ├── mocks.js │ ├── output │ │ ├── jsonSpec.js │ │ ├── objectSpec.js │ │ └── xmlSpec.js │ ├── ScenarioSpec.js │ └── matchersSpec.js ├── ng │ ├── windowSpec.js │ ├── documentSpec.js │ ├── rootElementSpec.js │ ├── directive │ │ ├── ngSrcsetSpec.js │ │ ├── ngClickSpec.js │ │ ├── styleSpec.js │ │ ├── ngEventDirsSpec.js │ │ ├── scriptSpec.js │ │ ├── ngInitSpec.js │ │ ├── ngNonBindableSpec.js │ │ └── ngCloakSpec.js │ ├── exceptionHandlerSpec.js │ ├── filter │ │ └── orderBySpec.js │ ├── filterSpec.js │ ├── localeSpec.js │ └── urlUtilsSpec.js ├── helpers │ ├── privateMocks.js │ └── privateMocksSpec.js ├── ApiSpecs.js ├── ngSanitize │ ├── directive │ │ └── ngBindHtmlSpec.js │ └── filter │ │ └── linkySpec.js └── e2e │ └── docsAppE2E.js ├── i18n ├── run-tests.sh ├── generate.sh ├── src │ ├── util.js │ └── parser.js ├── e2e │ ├── runner.html │ ├── localeTest_cs.html │ ├── localeTest_de.html │ ├── localeTest_es.html │ ├── localeTest_sk.html │ └── localeTest_zh.html ├── README.md ├── spec │ └── utilSpec.js └── update-closure.sh ├── check-size.sh ├── scripts ├── travis │ ├── wait_for_browser_provider.sh │ ├── print_logs.sh │ └── build.sh ├── angular.js │ ├── finalize-version.sh │ ├── publish-cdn-version.sh │ ├── initialize-new-version.sh │ └── publish.sh ├── jenkins │ ├── master.sh │ ├── release-after-cdn.sh │ └── release.sh ├── angular-seed │ └── publish.sh ├── angular-phonecat │ └── publish.sh └── angularjs.org │ └── publish.sh ├── css └── angular.css ├── watchr-docs.rb ├── .gitignore ├── protractor-conf.js ├── karma-modules.conf.js ├── karma-jqlite.conf.js ├── bower.json ├── karma-jquery.conf.js ├── gen_docs.sh ├── init-repo.sh ├── karma-e2e.conf.js ├── closure └── README.md ├── .travis.yml ├── LICENSE ├── karma-docs.conf.js ├── jenkins_build.sh ├── package.json └── changelog.spec.js /docs/content/notes/empty.tmp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /example/view1.html: -------------------------------------------------------------------------------- 1 | view1
2 | location: {{url()}} 3 | -------------------------------------------------------------------------------- /src/module.suffix: -------------------------------------------------------------------------------- 1 | 2 | })(window, window.angular); 3 | -------------------------------------------------------------------------------- /example/view2.html: -------------------------------------------------------------------------------- 1 | view2
2 | location: {{url()}}
3 | -------------------------------------------------------------------------------- /lib/browser-stack/start-tunnel.sh: -------------------------------------------------------------------------------- 1 | node ./lib/browser-stack/start-tunnel.js & 2 | -------------------------------------------------------------------------------- /src/publishExternalApis.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | publishExternalAPI(angular); 4 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "json": "bower.json" 4 | } 5 | -------------------------------------------------------------------------------- /images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/favicon.ico -------------------------------------------------------------------------------- /docs/img/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/bullet.png -------------------------------------------------------------------------------- /docs/img/helloworld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/helloworld.png -------------------------------------------------------------------------------- /test/jquery_alias.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _jQuery = jQuery, 4 | _jqLiteMode = false; 5 | -------------------------------------------------------------------------------- /images/css/arrow_left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/css/arrow_left.gif -------------------------------------------------------------------------------- /docs/img/AngularJS-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/AngularJS-small.png -------------------------------------------------------------------------------- /docs/img/angular_parts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/angular_parts.png -------------------------------------------------------------------------------- /docs/img/form_data_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/form_data_flow.png -------------------------------------------------------------------------------- /docs/img/helloworld_2way.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/helloworld_2way.png -------------------------------------------------------------------------------- /images/css/arrow_right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/css/arrow_right.gif -------------------------------------------------------------------------------- /docs/src/templates/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/src/templates/favicon.ico -------------------------------------------------------------------------------- /images/css/indicator-wait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/css/indicator-wait.png -------------------------------------------------------------------------------- /docs/img/One_Way_Data_Binding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/One_Way_Data_Binding.png -------------------------------------------------------------------------------- /docs/img/Two_Way_Data_Binding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/Two_Way_Data_Binding.png -------------------------------------------------------------------------------- /docs/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /docs/img/guide/concepts-scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-scope.png -------------------------------------------------------------------------------- /docs/img/guide/concepts-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-view.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_00.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_02.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_03.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_04.png -------------------------------------------------------------------------------- /test/jquery_remove.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _jQuery = jQuery.noConflict(true), 4 | _jqLiteMode = true; 5 | -------------------------------------------------------------------------------- /docs/img/guide/concepts-runtime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-runtime.png -------------------------------------------------------------------------------- /docs/img/guide/concepts-startup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-startup.png -------------------------------------------------------------------------------- /docs/img/guide/dom_scope_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/dom_scope_final.png -------------------------------------------------------------------------------- /docs/img/guide/scenario_runner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/scenario_runner.png -------------------------------------------------------------------------------- /i18n/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | PARENT_DIR="$(dirname "$0")" 5 | jasmine-node "$PARENT_DIR"/spec/ 6 | -------------------------------------------------------------------------------- /docs/img/guide/concepts-directive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-directive.png -------------------------------------------------------------------------------- /docs/img/guide/di_sequence_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/di_sequence_final.png -------------------------------------------------------------------------------- /docs/img/guide/simple_scope_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/simple_scope_final.png -------------------------------------------------------------------------------- /docs/img/tutorial/catalog_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/catalog_screen.png -------------------------------------------------------------------------------- /docs/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /docs/img/guide/concepts-databinding1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-databinding1.png -------------------------------------------------------------------------------- /docs/img/guide/concepts-databinding2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-databinding2.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_00_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_00_final.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_07_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_07_final.png -------------------------------------------------------------------------------- /docs/img/tutorial/xhr_service_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/xhr_service_final.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/image1.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/image2.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/image4.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/image8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/image8.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/image9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/image9.png -------------------------------------------------------------------------------- /images/logo/AngularJS.graffle/data.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.graffle/data.plist -------------------------------------------------------------------------------- /images/logo/AngularJS.graffle/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.graffle/image1.png -------------------------------------------------------------------------------- /images/logo/AngularJS.graffle/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.graffle/image2.png -------------------------------------------------------------------------------- /src/ng/directive/style.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var styleDirective = valueFn({ 4 | restrict: 'E', 5 | terminal: true 6 | }); 7 | -------------------------------------------------------------------------------- /docs/img/guide/concepts-module-injector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-module-injector.png -------------------------------------------------------------------------------- /docs/img/guide/concepts-module-service.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/concepts-module-service.png -------------------------------------------------------------------------------- /docs/img/guide/hashbang_vs_regular_url.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/guide/hashbang_vs_regular_url.jpg -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_08-09_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_08-09_final.png -------------------------------------------------------------------------------- /docs/img/tutorial/tutorial_10-11_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/docs/img/tutorial/tutorial_10-11_final.png -------------------------------------------------------------------------------- /images/logo/AngularJS.exports/AngularJS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.exports/AngularJS.pdf -------------------------------------------------------------------------------- /images/docs/guide/concepts.graffle/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/guide/concepts.graffle/image1.png -------------------------------------------------------------------------------- /images/docs/guide/concepts.graffle/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/guide/concepts.graffle/image4.png -------------------------------------------------------------------------------- /images/docs/guide/concepts.graffle/image5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/guide/concepts.graffle/image5.png -------------------------------------------------------------------------------- /check-size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | grunt minify 4 | gzip -c < build/angular.min.js > build/angular.min.js.gzip 5 | ls -l build/angular.min.* 6 | -------------------------------------------------------------------------------- /images/logo/AngularJS.exports/AngularJS-huge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.exports/AngularJS-huge.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/guide/simple_scope.graffle/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/guide/simple_scope.graffle/image7.png -------------------------------------------------------------------------------- /images/logo/AngularJS.exports/AngularJS-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.exports/AngularJS-large.png -------------------------------------------------------------------------------- /images/logo/AngularJS.exports/AngularJS-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.exports/AngularJS-medium.png -------------------------------------------------------------------------------- /images/logo/AngularJS.exports/AngularJS-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS.exports/AngularJS-small.png -------------------------------------------------------------------------------- /images/docs/Diagrams.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/Diagrams.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/simple_scope.graffle/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/simple_scope.graffle/image7.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_02.graffle/image11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_02.graffle/image11.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_03.graffle/image13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_03.graffle/image13.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_04.graffle/image15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_04.graffle/image15.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_07.graffle/image9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_07.graffle/image9.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_08-09.graffle/image10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_08-09.graffle/image10.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_10-11.graffle/image10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_10-11.graffle/image10.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_proto.graffle/image7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_proto.graffle/image7.png -------------------------------------------------------------------------------- /images/logo/AngularJS-Shield.exports/AngularJS-Shield.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS-Shield.exports/AngularJS-Shield.pdf -------------------------------------------------------------------------------- /images/docs/guide/simple_scope.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/guide/simple_scope.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /i18n/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASE_DIR=`dirname $0` 4 | cd $BASE_DIR 5 | 6 | 7 | ../node_modules/.bin/jasmine-node spec/ --noColor && node src/closureSlurper.js 8 | -------------------------------------------------------------------------------- /images/docs/guide/simple_scope.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/guide/simple_scope.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/simple_scope.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/simple_scope.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_02.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_02.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_03.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_03.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_04.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_04.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_07.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_07.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/logo/AngularJS-Shield.exports/AngularJS-Shield-huge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS-Shield.exports/AngularJS-Shield-huge.png -------------------------------------------------------------------------------- /images/logo/AngularJS-Shield.exports/AngularJS-Shield-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS-Shield.exports/AngularJS-Shield-large.png -------------------------------------------------------------------------------- /images/logo/AngularJS-Shield.exports/AngularJS-Shield-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS-Shield.exports/AngularJS-Shield-small.png -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_02.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_02.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_03.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_03.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_04.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_04.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_07.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_07.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_08-09.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_08-09.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_10-11.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_10-11.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_proto.graffle/QuickLook/Preview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_proto.graffle/QuickLook/Preview.pdf -------------------------------------------------------------------------------- /images/logo/AngularJS-Shield.exports/AngularJS-Shield-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/logo/AngularJS-Shield.exports/AngularJS-Shield-medium.png -------------------------------------------------------------------------------- /images/docs/tutorial/simple_scope.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/simple_scope.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_08-09.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_08-09.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_10-11.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_10-11.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /images/docs/tutorial/tutorial_proto.graffle/QuickLook/Thumbnail.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zog/angular.js/master/images/docs/tutorial/tutorial_proto.graffle/QuickLook/Thumbnail.tiff -------------------------------------------------------------------------------- /test/ngScenario/e2e/style.css: -------------------------------------------------------------------------------- 1 | th { 2 | text-align: left; 3 | } 4 | 5 | tr { 6 | border: 1px solid black; 7 | } 8 | 9 | .redbox { 10 | background-color: red; 11 | } 12 | -------------------------------------------------------------------------------- /docs/src/templates/offline.html: -------------------------------------------------------------------------------- 1 |

OFFLINE

2 | 3 |

This page is currently unavailable because your are offline.

4 |

Please connect to the Internet and reload the page.

5 | -------------------------------------------------------------------------------- /src/loader.prefix: -------------------------------------------------------------------------------- 1 | /** 2 | * @license AngularJS v"NG_VERSION_FULL" 3 | * (c) 2010-2014 Google, Inc. http://angularjs.org 4 | * License: MIT 5 | */ 6 | 'use strict'; 7 | (function() { 8 | -------------------------------------------------------------------------------- /scripts/travis/wait_for_browser_provider.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # Wait for Connect to be ready before exiting 5 | while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do 6 | sleep .5 7 | done 8 | -------------------------------------------------------------------------------- /src/module.prefix: -------------------------------------------------------------------------------- 1 | /** 2 | * @license AngularJS v"NG_VERSION_FULL" 3 | * (c) 2010-2014 Google, Inc. http://angularjs.org 4 | * License: MIT 5 | */ 6 | (function(window, angular, undefined) { 7 | -------------------------------------------------------------------------------- /src/angular.prefix: -------------------------------------------------------------------------------- 1 | /** 2 | * @license AngularJS v"NG_VERSION_FULL" 3 | * (c) 2010-2014 Google, Inc. http://angularjs.org 4 | * License: MIT 5 | */ 6 | (function(window, document, undefined) { 7 | -------------------------------------------------------------------------------- /test/ng/windowSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('$window', function() { 4 | it("should inject $window", inject(function($window) { 5 | expect($window).toBe(window); 6 | })); 7 | }); 8 | -------------------------------------------------------------------------------- /css/angular.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], 4 | .ng-cloak, .x-ng-cloak, 5 | .ng-hide { 6 | display: none !important; 7 | } 8 | 9 | ng\:form { 10 | display: block; 11 | } 12 | -------------------------------------------------------------------------------- /test/ng/documentSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('$document', function() { 4 | 5 | 6 | it("should inject $document", inject(function($document) { 7 | expect($document).toEqual(jqLite(document)); 8 | })); 9 | }); 10 | -------------------------------------------------------------------------------- /docs/content/error/animate/notcsel.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $animate:notcsel 3 | @fullName Not class CSS selector 4 | @description 5 | 6 | Expecting a CSS selector for class. Class selectors must start with `.`, for example: `.my-class-name`. 7 | -------------------------------------------------------------------------------- /src/ngScenario/angular.prefix: -------------------------------------------------------------------------------- 1 | /** 2 | * @license AngularJS v"NG_VERSION_FULL" 3 | * (c) 2010-2014 Google, Inc. http://angularjs.org 4 | * License: MIT 5 | */ 6 | (function(window, document){ 7 | var _jQuery = window.jQuery.noConflict(true); 8 | -------------------------------------------------------------------------------- /src/ngScenario/output/Object.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Creates a global value $result with the result of the runner. 5 | */ 6 | angular.scenario.output('object', function(context, runner, model) { 7 | runner.$window.$result = model.value; 8 | }); 9 | -------------------------------------------------------------------------------- /watchr-docs.rb: -------------------------------------------------------------------------------- 1 | # config file for watchr http://github.com/mynyml/watchr 2 | # install: gem install watchr 3 | # run: watch watchr-docs.rb 4 | 5 | watch( '^src/|^docs/' ) do 6 | system 'echo "\n\ndoc run started @ `date`"; node docs/src/gen-docs.js' 7 | end 8 | -------------------------------------------------------------------------------- /docs/content/error/interpolate/interr.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $interpolate:interr 3 | @fullName Interpolation Error 4 | @description 5 | 6 | This error occurs when interpolation fails due to some exception. The error 7 | message above should provide additional context. 8 | -------------------------------------------------------------------------------- /i18n/src/util.js: -------------------------------------------------------------------------------- 1 | exports.findLocaleId = function findLocaleId(str, type) { 2 | if (type === 'num') { 3 | return (str.match(/^NumberFormatSymbols_(.+)$/) || [])[1]; 4 | } else if (type == 'datetime') { 5 | return (str.match(/^DateTimeSymbols_(.+)$/) || [])[1]; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/ng/directive/directives.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function ngDirective(directive) { 4 | if (isFunction(directive)) { 5 | directive = { 6 | link: directive 7 | }; 8 | } 9 | directive.restrict = directive.restrict || 'AC'; 10 | return valueFn(directive); 11 | } 12 | -------------------------------------------------------------------------------- /docs/content/error/jqLite/offargs.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name jqLite:offargs 3 | @fullName Invalid jqLite#off() parameter 4 | @description 5 | 6 | This error occurs when trying to pass too many arguments to `jqLite#off`. Note 7 | that `jqLite#off` does not support namespaces or selectors like jQuery. 8 | -------------------------------------------------------------------------------- /src/ngScenario/output/Json.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Generates JSON output into a context. 5 | */ 6 | angular.scenario.output('json', function(context, runner, model) { 7 | model.on('RunnerEnd', function() { 8 | context.text(angular.toJson(model.value)); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /docs/content/error/sce/itype.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $sce:itype 3 | @fullName String Value is Required for SCE Trust Call 4 | @description 5 | 6 | {@link api/ng.$sce#methods_trustAs $sce.trustAs} requires a string value. 7 | 8 | Read more about {@link api/ng.$sce Strict Contextual Escaping (SCE)} in AngularJS. 9 | -------------------------------------------------------------------------------- /docs/content/error/jqLite/onargs.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name jqLite:onargs 3 | @fullName Invalid jqLite#on() Parameters 4 | @description 5 | 6 | This error occurs when trying to pass too many arguments to `jqLite#on`. Note 7 | that `jqLite#on` does not support the `selector` or `eventData` parameters as 8 | jQuery does. 9 | -------------------------------------------------------------------------------- /src/angular.suffix: -------------------------------------------------------------------------------- 1 | //try to bind to jquery now so that one can write angular.element().read() 2 | //but we will rebind on bootstrap again. 3 | bindJQuery(); 4 | 5 | publishExternalAPI(angular); 6 | 7 | jqLite(document).ready(function() { 8 | angularInit(document, bootstrap); 9 | }); 10 | 11 | })(window, document); 12 | -------------------------------------------------------------------------------- /docs/content/error/ng/areq.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ng:areq 3 | @fullName Bad Argument 4 | @description 5 | 6 | AngularJS often asserts that certain values will be present and truthy using a 7 | helper function. If the assertion fails, this error is thrown. To fix this problem, 8 | make sure that the value the assertion expects is defined and truthy. -------------------------------------------------------------------------------- /docs/content/error/sce/icontext.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $sce:icontext 3 | @fullName Invalid / Unknown SCE context 4 | @description 5 | 6 | The context enum passed to {@link api/ng.$sce#methods_trustAs $sce.trustAs} was not recognized. 7 | 8 | Please consult the list of {@link api/ng.$sce#contexts supported Strict Contextual Escaping (SCE) contexts}. 9 | -------------------------------------------------------------------------------- /docs/content/error/ng/badname.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ng:badname 3 | @fullName Bad `hasOwnProperty` Name 4 | @description 5 | 6 | Occurs when you try to use the name `hasOwnProperty` in a context where it is not allow. 7 | Generally, a name cannot be `hasOwnProperty` because it is used, internally, on a object 8 | and allowing such a name would break lookups on this object. -------------------------------------------------------------------------------- /scripts/travis/print_logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LOG_FILES=$LOGS_DIR/* 4 | 5 | for FILE in $LOG_FILES; do 6 | echo -e "\n\n\n" 7 | echo "================================================================================" 8 | echo " $FILE" 9 | echo "================================================================================" 10 | cat $FILE 11 | done 12 | -------------------------------------------------------------------------------- /docs/content/error/cacheFactory/iid.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $cacheFactory:iid 3 | @fullName Invalid ID 4 | @description 5 | 6 | This error occurs when trying to create a new `cache` object via {@link api/ng.$cacheFactory} with an ID that was already used to create another cache object. 7 | 8 | To resolve the error please use a different cache ID when calling `$cacheFactory`. 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | .DS_Store 3 | gen_docs.disable 4 | test.disable 5 | regression/temp*.html 6 | performance/temp*.html 7 | .idea/workspace.xml 8 | *~ 9 | *.swp 10 | angular.js.tmproj 11 | /node_modules/ 12 | /components/ 13 | /bower_components/ 14 | angular.xcodeproj 15 | .idea 16 | .agignore 17 | libpeerconnection.log 18 | npm-debug.log 19 | /tmp/ 20 | /scripts/bower/bower-* 21 | -------------------------------------------------------------------------------- /test/ng/rootElementSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('$rootElement', function() { 4 | it('should publish the bootstrap element into $rootElement', function() { 5 | var element = jqLite('
'); 6 | var injector = angular.bootstrap(element); 7 | 8 | expect(injector.get('$rootElement')[0]).toBe(element[0]); 9 | 10 | dealoc(element); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /docs/content/error/resource/badname.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $resource:badname 3 | @fullName Cannot use hasOwnProperty as a parameter name 4 | @description 5 | 6 | Occurs when you try to use the name `hasOwnProperty` as a name of a parameter. 7 | Generally, a name cannot be `hasOwnProperty` because it is used, internally, on a object 8 | and allowing such a name would break lookups on this object. -------------------------------------------------------------------------------- /docs/content/error/ngPattern/noregexp.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ngPattern:noregexp 3 | @fullName Expected Regular Expression 4 | @description 5 | This error occurs when 'ngPattern' is passed an expression that isn't a regular expression or doesn't have the expected format. 6 | 7 | For more information on valid expression syntax, see 'ngPattern' in {@link api/ng.directive:input input} directive docs. 8 | -------------------------------------------------------------------------------- /src/ng/document.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc object 5 | * @name ng.$document 6 | * @requires $window 7 | * 8 | * @description 9 | * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object. 10 | */ 11 | function $DocumentProvider(){ 12 | this.$get = ['$window', function(window){ 13 | return jqLite(window.document); 14 | }]; 15 | } 16 | -------------------------------------------------------------------------------- /protractor-conf.js: -------------------------------------------------------------------------------- 1 | exports.config = { 2 | allScriptsTimeout: 11000, 3 | 4 | specs: [ 5 | 'build/docs/ptore2e/**/*.js', 6 | 'test/e2e/docsAppE2E.js' 7 | ], 8 | 9 | capabilities: { 10 | 'browserName': 'chrome' 11 | }, 12 | 13 | baseUrl: 'http://localhost:8000/build/docs/', 14 | 15 | framework: 'jasmine', 16 | 17 | jasmineNodeOpts: { 18 | defaultTimeoutInterval: 30000 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /docs/content/error/parse/lexerr.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $parse:lexerr 3 | @fullName Lexer Error 4 | @description 5 | 6 | Occurs when an expression has a lexical error, for example a malformed number (0.5e-) or an invalid unicode escape. 7 | 8 | The error message contains a more precise error. 9 | 10 | To resolve, learn more about {@link guide/expression Angular expressions}, identify the error and fix the expression's syntax. 11 | -------------------------------------------------------------------------------- /docs/content/error/parse/ueoe.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $parse:ueoe 3 | @fullName Unexpected End of Expression 4 | @description 5 | 6 | Occurs when an expression is missing tokens at the end of the expression. 7 | For example, forgetting a closing bracket in an expression will trigger this error. 8 | 9 | To resolve, learn more about {@link guide/expression Angular expressions}, identify the error and fix the expression's syntax. 10 | -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/content/error/parse/isecfn.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $parse:isecfn 3 | @fullName Referencing Function Disallowed 4 | @description 5 | 6 | Occurs when an expression attempts to access the 'Function' object (constructor for all functions in JavaScript). 7 | 8 | Angular bans access to Function from within expressions since constructor access is a known way to execute arbitrary Javascript code. 9 | 10 | To resolve this error, avoid Function access. 11 | -------------------------------------------------------------------------------- /docs/content/error/sce/imatcher.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $sce:imatcher 3 | @fullName Invalid matcher (only string patterns and RegExp instances are supported) 4 | @description 5 | 6 | Please see {@link api/ng.$sceDelegateProvider#methods_resourceUrlWhitelist 7 | $sceDelegateProvider.resourceUrlWhitelist} and {@link 8 | api/ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} for the 9 | list of acceptable items. 10 | -------------------------------------------------------------------------------- /i18n/e2e/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <angular/> Docs Scenario Runner 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/ngCookies/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise": true, 3 | "immed": true, 4 | "newcap": true, 5 | "noarg": true, 6 | "noempty": true, 7 | "nonew": true, 8 | "trailing": true, 9 | "maxlen": 100, 10 | "boss": true, 11 | "eqnull": true, 12 | "expr": true, 13 | "globalstrict": true, 14 | "laxbreak": true, 15 | "loopfunc": true, 16 | "sub": true, 17 | "undef": true, 18 | "browser": true, 19 | "globals": { 20 | "angular": false 21 | } 22 | } -------------------------------------------------------------------------------- /src/ngResource/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise": true, 3 | "immed": true, 4 | "newcap": true, 5 | "noarg": true, 6 | "noempty": true, 7 | "nonew": true, 8 | "trailing": true, 9 | "maxlen": 100, 10 | "boss": true, 11 | "eqnull": true, 12 | "expr": true, 13 | "globalstrict": true, 14 | "laxbreak": true, 15 | "loopfunc": true, 16 | "sub": true, 17 | "undef": true, 18 | "browser": true, 19 | "globals": { 20 | "angular": false 21 | } 22 | } -------------------------------------------------------------------------------- /test/ngScenario/e2e/Runner-compiled.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/content/error/resource/badargs.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $resource:badargs 3 | @fullName Too Many Arguments 4 | @description 5 | 6 | This error occurs when specifying too many arguments to a {@link api/ngResource.$resource `$resource`} action, such as `get`, `query` or any user-defined custom action. 7 | These actions may take up to 4 arguments. 8 | 9 | For more information, refer to the {@link api/ngResource.$resource `$resource`} API reference documentation. 10 | -------------------------------------------------------------------------------- /docs/content/error/location/isrcharg.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $location:isrcharg 3 | @fullName Wrong $location.search() argument type 4 | @description 5 | 6 | To resolve this error, ensure that the first argument for the `$location.search` call is a `string` or an object. 7 | You can use the stack trace associated with this error to identify the call site that caused this issue. 8 | 9 | To learn more, please consult the {@link api/ng.$location `$location`} api docs. 10 | -------------------------------------------------------------------------------- /docs/content/error/injector/modulerr.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $injector:modulerr 3 | @fullName Module Error 4 | @description 5 | 6 | This error occurs when a module fails to load due to some exception. The error 7 | message above should provide additional context. 8 | 9 | In AngularJS `1.2.0` and later, `ngRoute` has been moved to its own module. 10 | If you are getting this error after upgrading to `1.2.x`, be sure that you've 11 | installed {@link api/ngRoute `ngRoute`}. 12 | -------------------------------------------------------------------------------- /docs/content/error/ng/cpi.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ng:cpi 3 | @fullName Bad Copy 4 | @description 5 | 6 | This error occurs when attempting to copy an object to itself. Calling {@link 7 | api/angular.copy angular.copy} with a `destination` object deletes 8 | all of the elements or properties on `destination` before copying to it. Copying 9 | an object to itself is not supported. Make sure to check your calls to 10 | `angular.copy` and avoid copying objects or arrays to themselves. -------------------------------------------------------------------------------- /docs/content/error/ng/cpws.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ng:cpws 3 | @fullName Copying Window or Scope 4 | @description 5 | 6 | Copying Window or Scope instances is not supported because of cyclical and self 7 | references. Avoid copying windows and scopes, as well as any other cyclical or 8 | self-referential structures. Note that trying to deep copy an object containing 9 | cyclical references that is neither a window nor a scope will cause infinite 10 | recursion and a stack overflow. -------------------------------------------------------------------------------- /example/personalLog/scenario/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Personal Log Scenario Runner 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/content/api/ng.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name ng 3 | @description 4 | 5 | # ng (core module) 6 | The ng module is loaded by default when an AngularJS application is started. The module itself 7 | contains the essential components for an AngularJS application to function. The table below 8 | lists a high level breakdown of each of the services/factories, filters, directives and testing 9 | components available within this core module. 10 | 11 |
12 | -------------------------------------------------------------------------------- /docs/content/error/ngOptions/iexp.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ngOptions:iexp 3 | @fullName Invalid Expression 4 | @description 5 | This error occurs when 'ngOptions' is passed an expression that isn't in an expected form. 6 | 7 | Here's an example of correct syntax: 8 | 9 | ``` 10 |
16 | date: {{input | date:"medium"}}
17 | date: {{input | date:"longDate"}}
18 | number: {{input | number}}
19 | currency: {{input | currency }} 20 | 21 | 22 | -------------------------------------------------------------------------------- /i18n/e2e/localeTest_de.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | locale test 6 | 7 | 8 | 13 | 14 | 15 |
16 | date: {{input | date:"medium"}}
17 | date: {{input | date:"longDate"}}
18 | number: {{input | number}}
19 | currency: {{input | currency }} 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/content/error/sce/unsafe.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $sce:unsafe 3 | @fullName Require a safe/trusted value 4 | @description 5 | 6 | The value provided for use in a specific context was not found to be safe/trusted for use. 7 | 8 | Angular's {@link api/ng.$sce Strict Contextual Escaping (SCE)} mode 9 | (enabled by default), requires bindings in certain 10 | contexts to result in a value that is trusted as safe for use in such a context. (e.g. loading an 11 | Angular template from a URL requires that the URL is one considered safe for loading resources.) 12 | 13 | This helps prevent XSS and other security issues. Read more at {@link 14 | api/ng.$sce Strict Contextual Escaping (SCE)} 15 | 16 | -------------------------------------------------------------------------------- /docs/content/error/compile/tpload.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:tpload 3 | @fullName Error Loading Template 4 | @description 5 | 6 | This error occurs when {@link api/ng.$compile `$compile`} attempts to fetch a template from some URL, and the request fails. 7 | 8 | To resolve this error, ensure that the URL of the template is spelled correctly and resolves to correct absolute URL. 9 | The [Chrome Developer Tools](https://developers.google.com/chrome-developer-tools/docs/network#network_panel_overview) might also be helpful in determining why the request failed. 10 | 11 | If you are using {@link api/ng.$templateCache} to pre-load templates, ensure that the cache was populated with the template. 12 | -------------------------------------------------------------------------------- /i18n/e2e/localeTest_es.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | locale test 6 | 7 | 8 | 13 | 14 | 15 |
16 | date: {{input | date:"medium"}}
17 | date: {{input | date:"longDate"}}
18 | number: {{input | number}}
19 | currency: {{input | currency }} 20 | 21 | 22 | -------------------------------------------------------------------------------- /i18n/spec/utilSpec.js: -------------------------------------------------------------------------------- 1 | var util = require('../src/util.js'); 2 | 3 | describe('findLocaleId', function() { 4 | it('should find localeId', function() { 5 | expect(util.findLocaleId('', 'num')).toBeUndefined(); 6 | expect(util.findLocaleId('aa', 'datetime')).toBeUndefined(); 7 | expect(util.findLocaleId('aa', 'randomType')).toBeUndefined(); 8 | expect(util.findLocaleId('NumberFormatSymbols_en', 'datetime')).toBeUndefined(); 9 | expect(util.findLocaleId('DateTimeSymbols_en', 'num')).toBeUndefined(); 10 | 11 | expect(util.findLocaleId('DateTimeSymbols_en', 'datetime')).toBe('en'); 12 | expect(util.findLocaleId('NumberFormatSymbols_en_US', 'num')).toBe('en_US'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /docs/content/error/location/ihshprfx.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $location:ihshprfx 3 | @fullName Missing Hash Prefix 4 | @description 5 | 6 | This error occurs when {@link api/ng.$location $location} service is configured to use a hash prefix but this prefix was not present in a url that the `$location` service was asked to parse. 7 | 8 | For example if you configure `$location` service with prefix `'!'`: 9 | ``` 10 | myApp.config(function($locationProvider) { 11 | $locationProvider.prefix('!'); 12 | }); 13 | ``` 14 | 15 | If you enter the app at url `http:/myapp.com/#/myView` this error will be throw. 16 | 17 | The correct url for this configuration is `http:/myapp.com/#!/myView` (note the `'!'` after `'#'` symbol). 18 | -------------------------------------------------------------------------------- /init-repo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Script to initialize angular repo 4 | # - install required node packages 5 | # - install Karma 6 | # - install git hooks 7 | 8 | 9 | node=`which node 2>&1` 10 | if [ $? -ne 0 ]; then 11 | echo "Please install NodeJS." 12 | echo "http://nodejs.org/" 13 | exit 1 14 | fi 15 | 16 | npm=`which npm 2>&1` 17 | if [ $? -ne 0 ]; then 18 | echo "Please install NPM." 19 | fi 20 | 21 | 22 | echo "Installing required npm packages..." 23 | npm install 24 | 25 | karma=`which karma 2>&1` 26 | if [ $? -ne 0 ]; then 27 | echo "Installing Karma..." 28 | npm install -g karma 29 | fi 30 | 31 | echo "Installing git hooks..." 32 | ln -sf ../../validate-commit-msg.js .git/hooks/commit-msg 33 | -------------------------------------------------------------------------------- /scripts/travis/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev` 6 | 7 | if [ $JOB = "unit" ]; then 8 | grunt ci-checks 9 | grunt test:docgen 10 | grunt test:promises-aplus 11 | grunt test:unit --browsers SL_Chrome,SL_Safari,SL_Firefox,SL_IE_8,SL_IE_9,SL_IE_10,SL_IE_11 --reporters dots 12 | elif [ $JOB = "e2e" ]; then 13 | grunt test:e2e --browsers SL_Chrome --reporters dots 14 | grunt test:protractor --sauceUser $SAUCE_USERNAME \ 15 | --sauceKey $SAUCE_ACCESS_KEY \ 16 | --capabilities.tunnel-identifier=$TRAVIS_JOB_NUMBER \ 17 | --capabilities.build=$TRAVIS_BUILD_NUMBER 18 | else 19 | echo "Unknown job type. Please set JOB=unit or JOB=e2e." 20 | fi 21 | -------------------------------------------------------------------------------- /docs/content/error/sce/iequirks.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $sce:iequirks 3 | @fullName IE8 in quirks mode is unsupported 4 | @description 5 | 6 | This error occurs when you are using AngularJS with {@link api/ng.$sce Strict Contextual Escaping (SCE)} mode enabled (the default) on IE8 or lower in quirks mode. 7 | 8 | In this mode, IE8 allows one to execute arbitrary javascript by the use of the `expression()` syntax and is not supported. 9 | Refer {@link http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx MSDN Blogs > IEBlog > Ending Expressions} to learn more about them. 10 | 11 | To resolve this error please specify the proper doctype at the top of your main html document: 12 | 13 | ``` 14 | 15 | ``` 16 | -------------------------------------------------------------------------------- /test/helpers/privateMocks.js: -------------------------------------------------------------------------------- 1 | function createMockStyleSheet(doc, wind) { 2 | doc = doc ? doc[0] : document; 3 | wind = wind || window; 4 | 5 | var node = doc.createElement('style'); 6 | var head = doc.getElementsByTagName('head')[0]; 7 | head.appendChild(node); 8 | 9 | var ss = doc.styleSheets[doc.styleSheets.length - 1]; 10 | 11 | return { 12 | addRule : function(selector, styles) { 13 | try { 14 | ss.insertRule(selector + '{ ' + styles + '}', 0); 15 | } 16 | catch(e) { 17 | try { 18 | ss.addRule(selector, styles); 19 | } 20 | catch(e) {} 21 | } 22 | }, 23 | 24 | destroy : function() { 25 | head.removeChild(node); 26 | } 27 | }; 28 | }; 29 | -------------------------------------------------------------------------------- /docs/content/error/parse/isecdom.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $parse:isecdom 3 | @fullName Referencing a DOM node in Expression 4 | @description 5 | 6 | Occurs when an expression attempts to access a DOM node. 7 | 8 | AngularJS restricts access to DOM nodes from within expressions since it's a known way to 9 | execute arbitrary Javascript code. 10 | 11 | This check is only performed on object index and function calls in Angular expressions. These are 12 | places that are harder for the developer to guard. Dotted member access (such as a.b.c) does not 13 | perform this check - it's up to the developer to not expose such sensitive and powerful objects 14 | directly on the scope chain. 15 | 16 | To resolve this error, avoid access to DOM nodes. 17 | -------------------------------------------------------------------------------- /docs/content/error/controller/noscp.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $controller:noscp 3 | @fullName Missing $scope object 4 | @description 5 | 6 | This error occurs when {@link api/ng.$controller $controller} service is called in order to instantiate a new controller but no scope is provided via `$scope` property of the locals map. 7 | 8 | Example of incorrect usage that leads to this error: 9 | ``` 10 | $controller(MyController); 11 | //or 12 | $controller(MyController, {scope: newScope}); 13 | ``` 14 | 15 | To fix the example above please provide a scope to the $controller call: 16 | 17 | ``` 18 | $controller(MyController, {$scope, newScope}); 19 | ``` 20 | 21 | Please consult the {@link api/ng.$controller $controller} service api docs to learn more. 22 | -------------------------------------------------------------------------------- /docs/content/error/parse/isecwindow.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $parse:isecwindow 3 | @fullName Referencing Window object in Expression 4 | @description 5 | 6 | Occurs when an expression attempts to access a Window object. 7 | 8 | AngularJS restricts access to the Window object from within expressions since it's a known way to 9 | execute arbitrary Javascript code. 10 | 11 | This check is only performed on object index and function calls in Angular expressions. These are 12 | places that are harder for the developer to guard. Dotted member access (such as a.b.c) does not 13 | perform this check - it's up to the developer to not expose such sensitive and powerful objects 14 | directly on the scope chain. 15 | 16 | To resolve this error, avoid Window access. 17 | -------------------------------------------------------------------------------- /docs/content/error/ngRepeat/iexp.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ngRepeat:iexp 3 | @fullName Invalid Expression 4 | @description 5 | 6 | Occurs when there is a syntax error in an {@link api/ng.directive:ngRepeat ngRepeat}'s expression. The expression should be in the form '_item_ in _collection_[ track by _id_]'. 7 | 8 | Be aware, the ngRepeat directive parses the expression using a regex before sending _collection_ and optionally _id_ to the AngularJS parser. This error comes from the regex parsing. 9 | 10 | To resolve, identify and fix errors in the expression, paying special attention to the 'in' and 'track by' keywords in the expression. 11 | 12 | Please consult the api documentation of {@link api/ng.directive:ngRepeat ngRepeat} to learn more about valid syntax. 13 | -------------------------------------------------------------------------------- /docs/content/error/injector/pget.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $injector:pget 3 | @fullName Provider Missing $get 4 | @description 5 | 6 | This error occurs when attempting to register a provider that does not have a 7 | `$get` method. For example: 8 | 9 | ``` 10 | function BadProvider() {} // No $get method! 11 | angular.module("myApp", []) 12 | .provider('bad', BadProvider); // this throws the error 13 | ``` 14 | 15 | To fix the error, fill in the `$get` method on the provider like so: 16 | 17 | ``` 18 | function GoodProvider() { 19 | this.$get = angular.noop; 20 | } 21 | angular.module("myApp", []) 22 | .provider('good', GoodProvider); 23 | ``` 24 | 25 | For more information, refer to the {@link api/AUTO.$provide#methods_provider 26 | $provide.provider} api doc. -------------------------------------------------------------------------------- /i18n/update-closure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e # Exit on error. 4 | 5 | BASE_DIR=`dirname $0` 6 | cd $BASE_DIR 7 | 8 | set -x # Trace commands as they're executed. 9 | 10 | curl http://closure-library.googlecode.com/svn/trunk/closure/goog/i18n/currency.js > closure/currencySymbols.js 11 | curl http://closure-library.googlecode.com/svn/trunk/closure/goog/i18n/datetimesymbols.js > closure/datetimeSymbols.js 12 | curl http://closure-library.googlecode.com/svn/trunk/closure/goog/i18n/datetimesymbolsext.js > closure/datetimeSymbolsExt.js 13 | curl http://closure-library.googlecode.com/svn/trunk/closure/goog/i18n/numberformatsymbols.js > closure/numberSymbols.js 14 | curl http://closure-library.googlecode.com/svn/trunk/closure/goog/i18n/pluralrules.js > closure/pluralRules.js 15 | -------------------------------------------------------------------------------- /scripts/angular.js/publish-cdn-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script for updating cdnVersion of angular.js 4 | 5 | echo "###################################" 6 | echo "## Update angular.js cdnVersion ###" 7 | echo "###################################" 8 | 9 | ARG_DEFS=( 10 | "--cdn-version=(.*)" 11 | "--action=(prepare|publish)" 12 | ) 13 | 14 | function init { 15 | cd ../.. 16 | } 17 | 18 | function prepare { 19 | replaceJsonProp "package.json" "cdnVersion" "(.*)" "$CDN_VERSION" 20 | git add package.json 21 | git commit -m "chore(release): update cdn version" 22 | } 23 | 24 | function publish { 25 | BRANCH=$(git rev-parse --abbrev-ref HEAD) 26 | # push the commits to github 27 | git push origin $BRANCH 28 | } 29 | 30 | source $(dirname $0)/../utils.inc 31 | -------------------------------------------------------------------------------- /karma-e2e.conf.js: -------------------------------------------------------------------------------- 1 | var sharedConfig = require('./karma-shared.conf'); 2 | 3 | module.exports = function(config) { 4 | sharedConfig(config, {testName: 'AngularJS: e2e', logFile: 'karma-e2e.log'}); 5 | 6 | config.set({ 7 | frameworks: [], 8 | files: [ 9 | 'build/angular-scenario.js', 10 | 'node_modules/karma-ng-scenario/lib/adapter.js', 11 | 'build/docs/docs-scenario.js' 12 | ], 13 | 14 | proxies: { 15 | // angular.js, angular-resource.js, etc 16 | '/angular': 'http://localhost:8000/build/angular', 17 | '/': 'http://localhost:8000/build/docs/' 18 | }, 19 | 20 | junitReporter: { 21 | outputFile: 'test_out/e2e.xml', 22 | suite: 'E2E' 23 | }, 24 | 25 | browserNoActivityTimeout: 90000 26 | }); 27 | }; 28 | -------------------------------------------------------------------------------- /closure/README.md: -------------------------------------------------------------------------------- 1 | This file contains externs for use with the Closure compiler (aka JSCompiler). 2 | Passing these files to the --externs parameter of a compiler pass allows using 3 | type annotations for AngularJS objects. For example, Angular's $scope objects 4 | can be annotated as: 5 | ```js 6 | /** @type {angular.Scope} */ 7 | var scope = $scope; 8 | ``` 9 | 10 | This allows JSCompiler to type check accesses to scope, give warnings about 11 | missing methods or incorrect arguments, and also prevents renaming of property 12 | accesses with advanced compilation. 13 | 14 | The externs are incomplete and maintained on an as-needed basis, but strive to 15 | be correct. Externs for individual modules should be added in separate files. 16 | 17 | See https://developers.google.com/closure/compiler/ 18 | -------------------------------------------------------------------------------- /docs/content/error/compile/multidir.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:multidir 3 | @fullName Multiple Directive Resource Contention 4 | @description 5 | 6 | This error occurs when multiple directives are applied to the same DOM element, and 7 | processing them would result in a collision or an unsupported configuration. 8 | 9 | 10 | To resolve this issue remove one of the directives which is causing the collision. 11 | 12 | Example scenarios of multiple incompatible directives applied to the same element include: 13 | 14 | * Multiple directives requesting `isolated scope`. 15 | * Multiple directives publishing a controller under the same name. 16 | * Multiple directives declared with the `transclusion` option. 17 | * Multiple directives attempting to define a `template` or `templateURL`. 18 | -------------------------------------------------------------------------------- /scripts/angular.js/initialize-new-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "############################################" 4 | echo "## Increment version, add "-snapshot" and set version name ##" 5 | echo "############################################" 6 | 7 | ARG_DEFS=( 8 | "--next-version-type=(patch|minor|major)" 9 | "--next-version-name=(.+)" 10 | ) 11 | 12 | function run { 13 | cd ../.. 14 | 15 | grunt bump:$NEXT_VERSION_TYPE 16 | NEXT_VERSION=$(readJsonProp "package.json" "version") 17 | replaceJsonProp "package.json" "version" "(.*)" "\2-snapshot" 18 | replaceJsonProp "package.json" "codename" ".*" "$NEXT_VERSION_NAME" 19 | 20 | git add package.json 21 | git commit -m "chore(release): start v$NEXT_VERSION ($NEXT_VERSION)" 22 | } 23 | 24 | source $(dirname $0)/../utils.inc 25 | -------------------------------------------------------------------------------- /docs/content/error/ng/btstrpd.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ng:btstrpd 3 | @fullName App Already Bootstrapped with this Element 4 | @description 5 | 6 | Occurs when calling angular.bootstrap on an element that has already been bootstrapped. 7 | 8 | This usually happens when you accidentally use both `ng-app` and `angular.bootstrap` to bootstrap an application. 9 | 10 | ``` 11 | 12 | ... 13 | 14 | 17 | 18 | 19 | ``` 20 | 21 | Note that for bootrapping purposes, the `` element is the same as `document`, so the following will also throw an error. 22 | ``` 23 | 24 | ... 25 | 28 | 29 | ``` 30 | -------------------------------------------------------------------------------- /test/ApiSpecs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('api', function() { 4 | 5 | describe('HashMap', function() { 6 | it('should do basic crud', function() { 7 | var map = new HashMap(); 8 | var key = {}; 9 | var value1 = {}; 10 | var value2 = {}; 11 | map.put(key, value1); 12 | map.put(key, value2); 13 | expect(map.get(key)).toBe(value2); 14 | expect(map.get({})).toBe(undefined); 15 | expect(map.remove(key)).toBe(value2); 16 | expect(map.get(key)).toBe(undefined); 17 | }); 18 | 19 | it('should init from an array', function() { 20 | var map = new HashMap(['a','b']); 21 | expect(map.get('a')).toBe(0); 22 | expect(map.get('b')).toBe(1); 23 | expect(map.get('c')).toBe(undefined); 24 | }); 25 | }); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.10 4 | 5 | env: 6 | matrix: 7 | - JOB=unit 8 | - JOB=e2e 9 | global: 10 | - SAUCE_USERNAME=angular-ci 11 | - SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987 12 | - BROWSER_STACK_USERNAME=VojtaJina 13 | - BROWSER_STACK_ACCESS_KEY=HAfHZaypxAc3PEUrUU9a 14 | - LOGS_DIR=/tmp/angular-build/logs 15 | - BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready 16 | 17 | before_script: 18 | - mkdir -p $LOGS_DIR 19 | - ./lib/sauce/sauce_connect_setup.sh 20 | - npm install -g grunt-cli 21 | - grunt bower 22 | - grunt bower 23 | - grunt package-without-bower 24 | - ./scripts/travis/wait_for_browser_provider.sh 25 | 26 | script: 27 | - ./scripts/travis/build.sh 28 | 29 | after_script: 30 | - ./scripts/travis/print_logs.sh 31 | -------------------------------------------------------------------------------- /docs/content/error/rootScope/infdig.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $rootScope:infdig 3 | @fullName Infinite $digest Loop 4 | @description 5 | 6 | This error occurs when the application's model becomes unstable and each `$digest` cycle triggers a state change and subsequent `$digest` cycle. 7 | Angular detects this situation and prevents an infinite loop from causing the browser to become unresponsive. 8 | 9 | For example, the situation can occur by setting up a watch on a path and subsequently updating the same path when the value changes. 10 | 11 | ``` 12 | $scope.$watch('foo', function() { 13 | $scope.foo = $scope.foo + 1; 14 | }); 15 | ``` 16 | 17 | The maximum number of allowed iterations of the `$digest` cycle is controlled via TTL setting which can be configured via {@link api/ng.$rootScopeProvider $rootScopeProvider}. 18 | -------------------------------------------------------------------------------- /test/ng/directive/ngClickSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('ngClick', function() { 4 | var element; 5 | 6 | afterEach(function() { 7 | dealoc(element); 8 | }); 9 | 10 | it('should get called on a click', inject(function($rootScope, $compile) { 11 | element = $compile('
')($rootScope); 12 | $rootScope.$digest(); 13 | expect($rootScope.clicked).toBeFalsy(); 14 | 15 | browserTrigger(element, 'click'); 16 | expect($rootScope.clicked).toEqual(true); 17 | })); 18 | 19 | it('should pass event object', inject(function($rootScope, $compile) { 20 | element = $compile('
')($rootScope); 21 | $rootScope.$digest(); 22 | 23 | browserTrigger(element, 'click'); 24 | expect($rootScope.event).toBeDefined(); 25 | })); 26 | }); 27 | -------------------------------------------------------------------------------- /docs/content/error/injector/unpr.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $injector:unpr 3 | @fullName Unknown Provider 4 | @description 5 | 6 | This error results from the `$injector` being unable to resolve a required 7 | dependency. To fix this, make sure the dependency is defined and spelled 8 | correctly. For example: 9 | 10 | ``` 11 | angular.module('myApp', []) 12 | .controller('myCtrl', ['myService', function (myService) { 13 | // Do something with myService 14 | }]); 15 | ``` 16 | 17 | This code will fail with `$injector:unpr` if `myService` is not defined. Making 18 | sure each dependency is defined will fix the problem. 19 | 20 | ``` 21 | angular.module('myApp', []) 22 | .service('myService', function () { /* ... */ }) 23 | .controller('myCtrl', ['myService', function (myService) { 24 | // Do something with myService 25 | }]); 26 | ``` -------------------------------------------------------------------------------- /docs/spec/sitemapSpec.js: -------------------------------------------------------------------------------- 1 | var SiteMap = require('../src/SiteMap.js').SiteMap; 2 | var Doc = require('../src/ngdoc.js').Doc; 3 | 4 | 5 | describe('sitemap', function() { 6 | it('should render empty sitemap', function() { 7 | var map = new SiteMap([]); 8 | expect(map.render()).toEqual([ 9 | '', 10 | '', 11 | '', ''].join('\n')); 12 | }); 13 | 14 | it('should render ngdoc url', function() { 15 | var map = new SiteMap([new Doc({section: 'foo', id: 'a.b.c<>\'"&'})]); 16 | expect(map.render()).toContain([ 17 | ' ', 18 | 'http://docs.angularjs.org/foo/a.b.c<>'"&', 19 | 'weekly', 20 | ''].join('')); 21 | 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /docs/content/error/ngRepeat/iidexp.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ngRepeat:iidexp 3 | @fullName Invalid Identifier 4 | @description 5 | 6 | Occurs when there is an error in the identifier part of {@link api/ng.directive:ngRepeat ngRepeat}'s expression. 7 | 8 | To resolve, use either a valid identifier or a tuple (_key_, _value_) where both _key_ and _value_ are valid identifiers. 9 | 10 | Examples of *invalid* syntax: 11 | 12 | ``` 13 |
14 |
15 |
16 | ``` 17 | 18 | Examples of *valid* syntax: 19 | 20 | ``` 21 |
22 |
23 | ``` 24 | 25 | Please consult the api documentation of {@link api/ng.directive:ngRepeat ngRepeat} to learn more about valid syntax. 26 | -------------------------------------------------------------------------------- /docs/content/error/ngModel/nonassign.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ngModel:nonassign 3 | @fullName Non-Assignable Expression 4 | @description 5 | 6 | This error occurs when expression the {@link api/ng.directive:ngModel ngModel} directive is bound to is a non-assignable expression. 7 | 8 | Examples using assignable expressions include: 9 | 10 | ``` 11 | 12 | 13 | 14 | ``` 15 | 16 | Examples of non-assignable expressions include: 17 | 18 | ``` 19 | 20 | 21 | 22 | 23 | ``` 24 | 25 | Always make sure that the expression bound via `ngModel` directive can be assigned to. 26 | 27 | For more information, see the {@link api/ng.directive:ngModel ngModel API doc}. 28 | -------------------------------------------------------------------------------- /docs/src/templates/.htaccess: -------------------------------------------------------------------------------- 1 | ## OFFLINE SUPPORT ## 2 | 3 | # These rules tell apache to check if there is a cookie called "offline", with value set to the 4 | # current angular version. If this rule matches the appcache-offline.manifest will be served for 5 | # requests to appcache.manifest 6 | # 7 | # This file must be processed by Grunt in order to replace %ANGULAR_VERSION% with the actual version. 8 | 9 | Options -Indexes 10 | RewriteEngine on 11 | RewriteCond %{HTTP_COOKIE} ng-offline="NG_VERSION_FULL" 12 | RewriteRule appcache.manifest appcache-offline.manifest 13 | 14 | ## Redirect to the latest manifest 15 | RewriteCond %{HTTP_HOST} ^docs-next\.angularjs\.org$ 16 | RewriteRule appcache.manifest http://code.angularjs.org/next/docs/appcache.manifest [R=301] 17 | 18 | ## HTML5 URL Support ## 19 | RewriteRule ^(guide|api|cookbook|misc|tutorial)(/.*)?$ index.html 20 | -------------------------------------------------------------------------------- /test/ng/exceptionHandlerSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('$exceptionHandler', function() { 4 | it('should log errors with single argument', function() { 5 | module(function($provide){ 6 | $provide.provider('$exceptionHandler', $ExceptionHandlerProvider); 7 | }); 8 | inject(function($log, $exceptionHandler) { 9 | $exceptionHandler('myError'); 10 | expect($log.error.logs.shift()).toEqual(['myError']); 11 | }); 12 | }); 13 | 14 | 15 | it('should log errors with multiple arguments', function() { 16 | module(function($provide){ 17 | $provide.provider('$exceptionHandler', $ExceptionHandlerProvider); 18 | }); 19 | inject(function($log, $exceptionHandler) { 20 | $exceptionHandler('myError', 'comment'); 21 | expect($log.error.logs.shift()).toEqual(['myError', 'comment']); 22 | }); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /docs/content/guide/dev_guide.services.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name Developer Guide: Angular Services 3 | @description 4 | 5 | Services are a feature that Angular brings to client-side web apps from the server side, where 6 | services have been commonly used for a long time. Services in Angular apps are substitutable 7 | objects that are wired together using {@link di dependency injection (DI)}. 8 | 9 | 10 | ## Related Topics 11 | 12 | * {@link dev_guide.services.understanding_services Understanding Angular Services} 13 | * {@link dev_guide.services.creating_services Creating Angular Services} 14 | * {@link dev_guide.services.managing_dependencies Managing Service Dependencies} 15 | * {@link dev_guide.services.injecting_controllers Injecting Services Into Controllers} 16 | * {@link dev_guide.services.testing_services Testing Angular Services} 17 | 18 | ## Related API 19 | 20 | * {@link api/ng Angular Service API} 21 | -------------------------------------------------------------------------------- /docs/content/error/injector/cdep.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $injector:cdep 3 | @fullName Circular Dependency 4 | @description 5 | 6 | This error occurs when the {@link api/angular.injector $injector} tries to get 7 | a service that depends on itself, either directly or indirectly. To fix this, 8 | construct your dependency chain such that there are no circular dependencies. 9 | 10 | For example: 11 | 12 | ``` 13 | angular.module('myApp', []) 14 | .factory('myService', function (myService) { 15 | // ... 16 | }) 17 | .controller('MyCtrl', function ($scope, myService) { 18 | // ... 19 | }); 20 | ``` 21 | 22 | When an instance of `MyCtrl` is created, the service `myService` will be created 23 | by the `$injector`. `myService` depends on itself, which causes the `$injector` 24 | to detect a circular dependency and throw the error. 25 | 26 | For more information, see the {@link guide/di Dependency Injection Guide}. -------------------------------------------------------------------------------- /test/ng/directive/styleSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('style', function() { 4 | var element; 5 | 6 | 7 | afterEach(function() { 8 | dealoc(element); 9 | }); 10 | 11 | 12 | it('should not compile style element', inject(function($compile, $rootScope) { 13 | element = jqLite(''); 14 | $compile(element)($rootScope); 15 | $rootScope.$digest(); 16 | 17 | // read innerHTML and trim to pass on IE8 18 | expect(trim(element[0].innerHTML)).toBe('should {{notBound}}'); 19 | })); 20 | 21 | 22 | it('should compile content of element with style attr', inject(function($compile, $rootScope) { 23 | element = jqLite('
{{bind}}
'); 24 | $compile(element)($rootScope); 25 | $rootScope.$apply(function() { 26 | $rootScope.bind = 'value'; 27 | }); 28 | 29 | expect(element.text()).toBe('value'); 30 | })); 31 | }); 32 | -------------------------------------------------------------------------------- /docs/content/error/compile/iscp.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:iscp 3 | @fullName Invalid Isolate Scope Definition 4 | @description 5 | 6 | When declaring isolate scope the scope definition object must be in specific format which starts with mode character (`@&=`) with an optional local name. 7 | 8 | ``` 9 | myModule.directive('directiveName', function factory() { 10 | return { 11 | ... 12 | scope: { 13 | 'attrName': '@', // OK 14 | 'attrName2': '=localName', // OK 15 | 'attrName3': 'name', // ERROR: missing mode @&= 16 | 'attrName4': ' = name', // ERROR: extra spaces 17 | 'attrName5': 'name=', // ERROR: must be prefixed with @&= 18 | } 19 | ... 20 | } 21 | }); 22 | ``` 23 | 24 | Please refer to the {@link api/ng.$compile#description_comprehensive-directive-api_directive-definition-object 25 | `scope` option} of the directive definition documentation to learn more about the API. 26 | -------------------------------------------------------------------------------- /src/ngScenario/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise": true, 3 | "immed": true, 4 | "newcap": true, 5 | "noarg": true, 6 | "noempty": true, 7 | "nonew": true, 8 | "trailing": true, 9 | "maxlen": 100, 10 | "boss": true, 11 | "eqnull": true, 12 | "expr": true, 13 | "globalstrict": true, 14 | "laxbreak": true, 15 | "loopfunc": true, 16 | "sub": true, 17 | "undef": true, 18 | "browser": true, 19 | "globals": { 20 | "angular": false, 21 | "includes": false, 22 | "asyncForEach": false, 23 | "msie": false, 24 | "browserTrigger": false, 25 | "console": false, 26 | "alert": false, 27 | "indexOf": false, 28 | "_jQuery": false, 29 | "angularInit": false, 30 | "formatException": false, 31 | "AnimationEvent": false, 32 | "TransitionEvent": false, 33 | "WebKitAnimationEvent": false, 34 | "WebKitTransitionEvent": false, 35 | "$runner": false, 36 | "callerFile": false 37 | } 38 | } -------------------------------------------------------------------------------- /docs/content/error/injector/itkn.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $injector:itkn 3 | @fullName Bad Injection Token 4 | @description 5 | 6 | This error occurs when using a bad token as a dependency injection annotation. 7 | Dependency injection annotation tokens should always be strings. Using any other 8 | type will cause this error to be thrown. 9 | 10 | Examples of code with bad injection tokens include: 11 | 12 | ``` 13 | var myCtrl = function ($scope, $http) { /* ... */ }; 14 | myCtrl.$inject = ['$scope', 42]; 15 | 16 | myAppModule.controller('MyCtrl', ['$scope', {}, function ($scope, $timeout) { 17 | // ... 18 | }]); 19 | ``` 20 | 21 | The bad injection tokens are `42` in the first example and `{}` in the second. 22 | To avoid the error, always use string literals for dependency injection annotation 23 | tokens. 24 | 25 | For an explanation of what injection annotations are and how to use them, refer 26 | to the {@link guide/di Dependency Injection Guide}. -------------------------------------------------------------------------------- /example/temp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | angular dev sandbox 5 | 6 | 19 | 20 | 21 | 22 |

23 | view1 | view2 | blank 24 |

25 | 26 |
27 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/content/error/resource/badmember.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $resource:badmember 3 | @fullName Syntax error in param value using @member lookup 4 | @description 5 | 6 | Occurs when there is a syntax error when attempting to extract a param 7 | value from the data object. 8 | 9 | Here's an example of valid syntax for `params` or `paramsDefault`: 10 | 11 | ````javascript 12 | { 13 | bar: '@foo.bar' 14 | } 15 | ```` 16 | 17 | The part following the `@`, `foo.bar` in this case, should be a simple 18 | dotted member lookup using only ASCII identifiers. This error occurs 19 | when there is an error in that expression. The following are all syntax 20 | errors 21 | 22 | | Value | Error | 23 | |---------|----------------| 24 | | `@` | Empty expression following `@`. | 25 | | `@1.a` | `1` is an invalid javascript identifier. | 26 | | `@.a` | Leading `.` is invalid. | 27 | | `@a[1]` | Only dotted lookups are supported (no index operator) | 28 | -------------------------------------------------------------------------------- /docs/content/error/injector/nomod.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $injector:nomod 3 | @fullName Module Unavailable 4 | @description 5 | 6 | This error occurs when trying to "re-open" a module that has not yet been defined. 7 | 8 | To define a new module, call {@link api/angular.module angular.module} with a name 9 | and an array of dependent modules, like so: 10 | 11 | ``` 12 | // When defining a module with no module dependencies, 13 | // the requires array should be defined and empty. 14 | var myApp = angular.module('myApp', []); 15 | ``` 16 | 17 | To retrieve a reference to the same module for further configuration, call 18 | `angular.module` without the `requires` array. 19 | 20 | ``` 21 | var myApp = angular.module('myApp'); 22 | ``` 23 | 24 | Calling `angular.module` without the `requires` array when the module has not yet 25 | been defined causes this error to be thrown. To fix it, define your module with 26 | a name and an empty array, as in the first example above. -------------------------------------------------------------------------------- /example/personalLog/personalLog.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Personal Log 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 |
22 | 23 |
24 |

Logs:

25 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/spec/specs.js: -------------------------------------------------------------------------------- 1 | if (global.jasmine) return; 2 | 3 | var jasmine = require('../../lib/jasmine-1.0.1'); 4 | 5 | for(var key in jasmine) { 6 | global[key] = jasmine[key]; 7 | } 8 | 9 | //Patch Jasmine for proper stack traces 10 | jasmine.Spec.prototype.fail = function(e) { 11 | var expectationResult = new jasmine.ExpectationResult({ 12 | passed: false, 13 | message: e ? jasmine.util.formatException(e) : 'Exception' 14 | }); 15 | // PATCH 16 | if (e) { 17 | expectationResult.trace = e; 18 | } 19 | this.results_.addResult(expectationResult); 20 | }; 21 | 22 | 23 | 24 | var isVerbose = false; 25 | var showColors = true; 26 | process.argv.forEach(function(arg){ 27 | switch(arg) { 28 | case '--color': showColors = true; break; 29 | case '--noColor': showColors = false; break; 30 | case '--verbose': isVerbose = true; break; 31 | } 32 | }); 33 | 34 | jasmine.executeSpecsInFolder(__dirname, function(runner, log){ 35 | process.exit(runner.results().failedCount); 36 | }, isVerbose, showColors); 37 | -------------------------------------------------------------------------------- /docs/content/error/compile/nodomevents.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:nodomevents 3 | @fullName Interpolated Event Attributes 4 | @description 5 | 6 | This error occurs when one tries to create a binding for event handler attributes like `onclick`, `onload`, `onsubmit`, etc. 7 | 8 | There is no practical value in binding to these attributes and doing so only exposes your application to security vulnerabilities like XSS. 9 | For these reasons binding to event handler attributes (all attributes that start with `on` and `formaction` attribute) is not supported. 10 | 11 | 12 | An example code that would allow XSS vulnerability by evaluating user input in the window context could look like this: 13 | ``` 14 | 15 |
click me
16 | ``` 17 | 18 | Since the `onclick` evaluates the value as JavaScript code in the window context, setting the `username` model to a value like `javascript:alert('PWND')` would result in script injection when the `div` is clicked. 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/src/SiteMap.js: -------------------------------------------------------------------------------- 1 | exports.SiteMap = SiteMap; 2 | 3 | /** 4 | * @see http://www.sitemaps.org/protocol.php 5 | * 6 | * @param docs 7 | * @returns {SiteMap} 8 | */ 9 | function SiteMap(docs){ 10 | this.render = function() { 11 | var map = []; 12 | map.push(''); 13 | map.push(''); 14 | docs.forEach(function(doc){ 15 | map.push(' http://docs.angularjs.org/' + 16 | encode(doc.section) + '/' + 17 | encode(doc.id) + 18 | 'weekly'); 19 | }); 20 | map.push(''); 21 | map.push(''); 22 | return map.join('\n'); 23 | }; 24 | 25 | function encode(text){ 26 | return text 27 | .replace(/&/mg, '&') 28 | .replace(//mg, '>') 30 | .replace(/'/mg, ''') 31 | .replace(/"/mg, '"'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/ngScenario/mocks.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | angular.scenario.testing = angular.scenario.testing || {}; 4 | 5 | angular.scenario.testing.MockAngular = function() { 6 | this.reset(); 7 | this.element = jqLite; 8 | }; 9 | 10 | angular.scenario.testing.MockAngular.prototype.reset = function() { 11 | this.log = []; 12 | }; 13 | 14 | angular.scenario.testing.MockAngular.prototype.poll = function() { 15 | this.log.push('$brower.poll()'); 16 | return this; 17 | }; 18 | 19 | angular.scenario.testing.MockRunner = function() { 20 | this.listeners = []; 21 | }; 22 | 23 | angular.scenario.testing.MockRunner.prototype.on = function(eventName, fn) { 24 | this.listeners[eventName] = this.listeners[eventName] || []; 25 | this.listeners[eventName].push(fn); 26 | }; 27 | 28 | angular.scenario.testing.MockRunner.prototype.emit = function(eventName) { 29 | var args = Array.prototype.slice.call(arguments, 1); 30 | angular.forEach(this.listeners[eventName] || [], function(fn) { 31 | fn.apply(this, args); 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /docs/content/error/compile/selmulti.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:selmulti 3 | @fullName Binding to Multiple Attribute 4 | @description 5 | 6 | Binding to the `multiple` attribute of `select` element is not supported since switching between multiple and single mode changes the {@link api/ng.directive:ngModel `ngModel`} object type from instance to array of instances which breaks the model semantics. 7 | 8 | If you need to use different types of `select` elements in your template based on some variable, please use {@link api/ng.directive:ngIf ngIf} or {@link api/ng.directive:ngSwitch ngSwitch} directives to select one of them to be used at runtime. 9 | 10 | 11 | Example with invalid usage: 12 | ``` 13 | 14 | ``` 15 | 16 | Example that uses ngIf to pick one of the `select` elements based on a variable: 17 | ``` 18 | 19 | 20 | ``` 21 | -------------------------------------------------------------------------------- /i18n/e2e/localeTest_sk.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | locale test 6 | 7 | 8 | 14 | 15 | 16 |
17 | date: {{input | date:"medium"}}
18 | date: {{input | date:"longDate"}}
19 | number: {{input | number}}
20 | currency: {{input | currency }} 21 |
22 |
23 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/ngSanitize/directive/ngBindHtmlSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | describe('ngBindHtml', function() { 5 | beforeEach(module('ngSanitize')); 6 | 7 | it('should set html', inject(function($rootScope, $compile) { 8 | var element = $compile('
')($rootScope); 9 | $rootScope.html = '
hello
'; 10 | $rootScope.$digest(); 11 | expect(angular.lowercase(element.html())).toEqual('
hello
'); 12 | })); 13 | 14 | 15 | it('should reset html when value is null or undefined', inject(function($compile, $rootScope) { 16 | var element = $compile('
')($rootScope); 17 | 18 | angular.forEach([null, undefined, ''], function(val) { 19 | $rootScope.html = 'some val'; 20 | $rootScope.$digest(); 21 | expect(angular.lowercase(element.html())).toEqual('some val'); 22 | 23 | $rootScope.html = val; 24 | $rootScope.$digest(); 25 | expect(angular.lowercase(element.html())).toEqual(''); 26 | }); 27 | })); 28 | }); 29 | -------------------------------------------------------------------------------- /docs/component-spec/versionJumpSpec.js: -------------------------------------------------------------------------------- 1 | describe('DocsApp', function() { 2 | 3 | // Do not run this suite on Internet Explorer. 4 | if (msie < 10) return; 5 | 6 | beforeEach(module('docsApp')); 7 | 8 | describe('DocsVersionsCtrl', function() { 9 | var $scope, ctrl, window, version = '9.8.7'; 10 | 11 | beforeEach(function() { 12 | module(function($provide) { 13 | $provide.value('$window', window = createMockWindow()); 14 | }); 15 | inject(function($controller, $rootScope) { 16 | $scope = $rootScope.$new(); 17 | $scope.version = version; 18 | ctrl = $controller('DocsVersionsCtrl',{ 19 | $scope : $scope, 20 | $window : window 21 | }); 22 | }); 23 | }); 24 | 25 | describe('changing the URL', function() { 26 | it('should jump to the url provided', function() { 27 | $scope.jumpToDocsVersion({ version: '1.0.1', url : 'page123'}); 28 | expect(window.location).toBe('page123'); 29 | }); 30 | }); 31 | }); 32 | 33 | }); 34 | -------------------------------------------------------------------------------- /docs/content/error/ngRepeat/dupes.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name ngRepeat:dupes 3 | @fullName Duplicate Key in Repeater 4 | @description 5 | 6 | Occurs if there are duplicate keys in an {@link api/ng.directive:ngRepeat ngRepeat} expression. Duplicate keys are banned because AngularJS uses keys to associate DOM nodes with items. 7 | 8 | By default, collections are keyed by reference which is desirable for most common models but can be problematic for primitive types that are interned (share references). 9 | 10 | For example the issue can be triggered by this *invalid* code: 11 | 12 | ``` 13 |
14 | ``` 15 | 16 | To resolve this error either ensure that the items in the collection have unique identity or use the `track by` syntax to specify how to track the association between models and DOM. 17 | 18 | To resolve the example above can be resolved by using `track by $index`, which will cause the items to be keyed by their position in the array instead of their value: 19 | 20 | ``` 21 |
22 | ``` 23 | -------------------------------------------------------------------------------- /scripts/jenkins/master.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "#################################" 4 | echo "#### Update master ##############" 5 | echo "#################################" 6 | 7 | ARG_DEFS=( 8 | "[--no-test=(true|false)]" 9 | ) 10 | 11 | function init { 12 | if [[ ! $VERBOSE ]]; then 13 | VERBOSE=false 14 | fi 15 | VERBOSE_ARG="--verbose=$VERBOSE" 16 | } 17 | 18 | function build { 19 | cd ../.. 20 | 21 | if [[ $NO_TEST == "true" ]]; then 22 | npm install --color false 23 | grunt ci-checks package --no-color 24 | else 25 | ./jenkins_build.sh 26 | fi 27 | 28 | cd $SCRIPT_DIR 29 | } 30 | 31 | function phase { 32 | ACTION_ARG="--action=$1" 33 | ../code.angularjs.org/publish.sh $ACTION_ARG $VERBOSE_ARG 34 | ../bower/publish.sh $ACTION_ARG $VERBOSE_ARG 35 | } 36 | 37 | function run { 38 | build 39 | 40 | # First prepare all scripts (build, test, commit, tag, ...), 41 | # so we are sure everything is all right 42 | phase prepare 43 | # only then publish to github 44 | phase publish 45 | } 46 | 47 | source $(dirname $0)/../utils.inc 48 | -------------------------------------------------------------------------------- /scripts/angular-seed/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script for updating angular-seed repo from current local build. 4 | 5 | echo "#################################" 6 | echo "## Update angular-seed ###" 7 | echo "#################################" 8 | 9 | ARG_DEFS=( 10 | "--action=(prepare|publish)" 11 | "[--no-test=(true|false)]" 12 | ) 13 | 14 | function init { 15 | TMP_DIR=$(resolveDir ../../tmp) 16 | BUILD_DIR=$(resolveDir ../../build) 17 | REPO_DIR=$TMP_DIR/angular-seed 18 | NEW_VERSION=$(cat $BUILD_DIR/version.txt) 19 | } 20 | 21 | function prepare { 22 | echo "-- Cloning angular-seed" 23 | git clone git@github.com:angular/angular-seed.git $REPO_DIR 24 | 25 | # 26 | # copy the files from the build 27 | # 28 | echo "-- Updating angular-seed" 29 | cd $REPO_DIR 30 | ./scripts/update-angular.sh $BUILD_DIR 31 | 32 | # Test 33 | if [[ $NO_TEST != "true" ]]; then 34 | ./scripts/test-all.sh 35 | fi 36 | } 37 | 38 | function publish { 39 | cd $REPO_DIR 40 | echo "-- Pushing angular-seed" 41 | git push origin master 42 | } 43 | 44 | source $(dirname $0)/../utils.inc 45 | -------------------------------------------------------------------------------- /docs/content/error/compile/uterdir.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:uterdir 3 | @fullName Unterminated Directive 4 | @description 5 | 6 | This error occurs when using multi-element directives and a `directive-start` attribute fails to form a matching pair with a corresponding `directive-end` attribute. 7 | A `directive-start` should have a matching `directive-end` on a sibling node in the DOM. For instance, 8 | 9 | ``` 10 | 11 | I get repeated 12 | I also get repeated 13 |
14 | ``` 15 | 16 | is a valid example. 17 | 18 | This error can occur in several different ways. One is by leaving out the `directive-end` attribute, like so: 19 | 20 | ``` 21 |
22 | 23 |
24 | ``` 25 | 26 | Another is by nesting a `directive-end` inside of `directive-start`, or vice versa: 27 | 28 | ``` 29 |
30 | 31 |
32 | ``` 33 | 34 | To avoid this error, make sure each `directive-start` you use has a matching `directive-end` on a sibling node in the DOM. 35 | -------------------------------------------------------------------------------- /docs/content/tutorial/the_end.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name Tutorial: The End 3 | @description 4 | 5 | Our application is now complete. Feel free to experiment with the code further, and jump back to 6 | previous steps using the `git checkout` command. 7 | 8 | For more details and examples of the Angular concepts we touched on in this tutorial, see the 9 | {@link guide/ Developer Guide}. 10 | 11 | For several more examples of code, see the {@link cookbook/ Cookbook}. 12 | 13 | When you are ready to start developing a project using Angular, we recommend that you bootstrap 14 | your development with the {@link https://github.com/angular/angular-seed angular-seed} project. 15 | 16 | We hope this tutorial was useful to you and that you learned enough about Angular to make you want 17 | to learn more. We especially hope you are inspired to go out and develop Angular web apps of your 18 | own, and that you might be interested in {@link misc/contribute contributing} to Angular. 19 | 20 | If you have questions or feedback or just want to say "hi", please post a message at {@link 21 | https://groups.google.com/forum/#!forum/angular}. 22 | -------------------------------------------------------------------------------- /scripts/jenkins/release-after-cdn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ARG_DEFS=( 4 | # require the git dryrun flag so the script can't be run without 5 | # thinking about this! 6 | "--git-push-dryrun=(true|false)" 7 | "--cdn-version=(.*)" 8 | ) 9 | 10 | function init { 11 | NG_ARGS=("$@") 12 | if [[ ! $VERBOSE ]]; then 13 | VERBOSE=false 14 | fi 15 | VERBOSE_ARG="--verbose=$VERBOSE" 16 | } 17 | 18 | function phase { 19 | ACTION_ARG="--action=$1" 20 | CDN_VERSION_ARG="--cdn-version=$CDN_VERSION" 21 | ./scripts/angular.js/publish-cdn-version.sh $ACTION_ARG $CDN_VERSION_ARG $VERBOSE_ARG 22 | ./scripts/angularjs.org/publish.sh $ACTION_ARG $CDN_VERSION_ARG $VERBOSE_ARG 23 | } 24 | 25 | function checkCdn { 26 | STATUS=$(curl http://ajax.googleapis.com/ajax/libs/angularjs/$CDN_VERSION/angular.min.js --write-out '%{http_code}' -o /dev/null -silent) 27 | if [[ $STATUS != 200 ]]; then 28 | echo "Could not find release $CDN_VERSION on CDN" 29 | exit 1 30 | fi 31 | } 32 | 33 | function run { 34 | cd ../.. 35 | checkCdn 36 | 37 | phase prepare 38 | phase publish 39 | } 40 | 41 | source $(dirname $0)/../utils.inc -------------------------------------------------------------------------------- /docs/spec/sourceLinkSpec.js: -------------------------------------------------------------------------------- 1 | var ngdoc = require('../src/ngdoc.js'); 2 | var gruntUtil = require('../../lib/grunt/utils.js'); 3 | 4 | describe('Docs Links', function() { 5 | 6 | describe('links', function() { 7 | var doc; 8 | 9 | beforeEach(function() { 10 | doc = new ngdoc.Doc("@ngdoc function\n@name ng.filter:a\n@function"); 11 | doc.section = 'api'; 12 | doc.file = 'test.js'; 13 | doc.line = 42; 14 | doc.parse(); 15 | }); 16 | 17 | it('should have an "improve this doc" button', function() { 18 | expect(doc.html()). 19 | toContain(' Improve this doc'); 20 | }); 21 | 22 | it('should have an "view source" button', function() { 23 | spyOn(gruntUtil, 'getVersion').andReturn({full: '1.2.299'}); 24 | 25 | expect(doc.html()). 26 | toContain(' View source'); 27 | }); 28 | }); 29 | 30 | }); 31 | -------------------------------------------------------------------------------- /scripts/angular.js/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script for updating angular.js repo from current local build. 4 | 5 | echo "#################################" 6 | echo "## Update angular.js ###" 7 | echo "#################################" 8 | 9 | ARG_DEFS=( 10 | "--action=(prepare|publish)" 11 | "--next-version-type=(patch|minor|major)" 12 | "--next-version-name=(.+)" 13 | "[--no-test=(true|false)]" 14 | ) 15 | 16 | function init { 17 | cd ../.. 18 | } 19 | 20 | function prepare() { 21 | ./scripts/angular.js/finalize-version.sh 22 | 23 | # Build 24 | if [[ $NO_TEST == "true" ]]; then 25 | npm install --color false 26 | grunt ci-checks package --no-color 27 | else 28 | ./jenkins_build.sh 29 | fi 30 | 31 | ./scripts/angular.js/initialize-new-version.sh --next-version-type=$NEXT_VERSION_TYPE --next-version-name=$NEXT_VERSION_NAME 32 | } 33 | 34 | function publish() { 35 | BRANCH=$(git rev-parse --abbrev-ref HEAD) 36 | # push the commits to github 37 | git push origin $BRANCH 38 | # push the release tag 39 | git push origin v`cat build/version.txt` 40 | } 41 | 42 | source $(dirname $0)/../utils.inc 43 | -------------------------------------------------------------------------------- /test/ngScenario/output/jsonSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('angular.scenario.output.json', function() { 4 | var output, context; 5 | var runner, model, $window; 6 | var spec, step; 7 | 8 | beforeEach(function() { 9 | $window = {}; 10 | context = _jQuery('
'); 11 | runner = new angular.scenario.testing.MockRunner(); 12 | model = new angular.scenario.ObjectModel(runner); 13 | output = angular.scenario.output.json(context, runner, model); 14 | spec = { 15 | name: 'test spec', 16 | definition: { 17 | id: 10, 18 | name: 'describe' 19 | } 20 | }; 21 | step = { 22 | name: 'some step', 23 | line: function() { return 'unknown:-1'; } 24 | }; 25 | }); 26 | 27 | it('should put json in context on RunnerEnd', function() { 28 | runner.emit('SpecBegin', spec); 29 | runner.emit('StepBegin', spec, step); 30 | runner.emit('StepEnd', spec, step); 31 | runner.emit('SpecEnd', spec); 32 | runner.emit('RunnerEnd'); 33 | 34 | expect(angular.fromJson(context.html()).children['describe'] 35 | .specs['test spec'].status).toEqual('success'); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010-2012 Google, Inc. http://angularjs.org 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 | 23 | -------------------------------------------------------------------------------- /karma-docs.conf.js: -------------------------------------------------------------------------------- 1 | var sharedConfig = require('./karma-shared.conf'); 2 | 3 | module.exports = function(config) { 4 | sharedConfig(config, {testName: 'AngularJS: docs', logFile: 'karma-docs.log'}); 5 | 6 | config.set({ 7 | files: [ 8 | 'build/docs/components/jquery.js', 9 | 'test/jquery_remove.js', 10 | 11 | 'build/angular.js', 12 | 'build/angular-cookies.js', 13 | 'build/angular-resource.js', 14 | 'build/angular-touch.js', 15 | 'build/angular-sanitize.js', 16 | 'build/angular-route.js', 17 | 'build/angular-animate.js', 18 | 'build/angular-mocks.js', 19 | 20 | 'build/docs/components/lunr.js', 21 | 'build/docs/components/google-code-prettify.js', 22 | 'build/docs/components/marked.js', 23 | 24 | 'build/docs/components/angular-bootstrap.js', 25 | 'build/docs/components/angular-bootstrap-prettify.js', 26 | 'build/docs/js/docs.js', 27 | 'build/docs/docs-data.js', 28 | 29 | 'docs/component-spec/mocks.js', 30 | 'docs/component-spec/*.js' 31 | ], 32 | 33 | junitReporter: { 34 | outputFile: 'test_out/docs.xml', 35 | suite: 'Docs' 36 | } 37 | }); 38 | }; 39 | -------------------------------------------------------------------------------- /docs/component-spec/mocks.js: -------------------------------------------------------------------------------- 1 | // Copy/pasted from src/Angular.js, so that we can disable specific tests on IE. 2 | var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1], 10); 3 | 4 | var createMockWindow = function() { 5 | var mockWindow = {}; 6 | var setTimeoutQueue = []; 7 | 8 | mockWindow.location = window.location; 9 | mockWindow.document = window.document; 10 | mockWindow.getComputedStyle = angular.bind(window, window.getComputedStyle); 11 | mockWindow.scrollTo = angular.bind(window, window.scrollTo); 12 | mockWindow.navigator = window.navigator; 13 | mockWindow.setTimeout = function(fn, delay) { 14 | setTimeoutQueue.push({fn: fn, delay: delay}); 15 | }; 16 | mockWindow.setTimeout.queue = setTimeoutQueue; 17 | mockWindow.setTimeout.expect = function(delay) { 18 | if (setTimeoutQueue.length > 0) { 19 | return { 20 | process: function() { 21 | var tick = setTimeoutQueue.shift(); 22 | expect(tick.delay).toEqual(delay); 23 | tick.fn(); 24 | } 25 | }; 26 | } else { 27 | expect('SetTimoutQueue empty. Expecting delay of ').toEqual(delay); 28 | } 29 | }; 30 | 31 | return mockWindow; 32 | }; 33 | -------------------------------------------------------------------------------- /test/ngScenario/output/objectSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('angular.scenario.output.object', function() { 4 | var output; 5 | var runner, model, $window; 6 | var spec, step; 7 | 8 | beforeEach(function() { 9 | $window = {}; 10 | runner = new angular.scenario.testing.MockRunner(); 11 | model = new angular.scenario.ObjectModel(runner); 12 | runner.$window = $window; 13 | output = angular.scenario.output.object(null, runner, model); 14 | spec = { 15 | name: 'test spec', 16 | definition: { 17 | id: 10, 18 | name: 'describe', 19 | children: [] 20 | } 21 | }; 22 | step = { 23 | name: 'some step', 24 | line: function() { return 'unknown:-1'; } 25 | }; 26 | }); 27 | 28 | it('should create a global variable $result', function() { 29 | expect($window.$result).toBeDefined(); 30 | }); 31 | 32 | it('should maintain live state in $result', function() { 33 | runner.emit('SpecBegin', spec); 34 | runner.emit('StepBegin', spec, step); 35 | runner.emit('StepEnd', spec, step); 36 | 37 | expect($window.$result.children['describe'] 38 | .specs['test spec'].steps[0].duration).toBeDefined(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /test/helpers/privateMocksSpec.js: -------------------------------------------------------------------------------- 1 | describe('private mocks', function() { 2 | describe('createMockStyleSheet', function() { 3 | 4 | it('should allow custom styles to be created and removed when the stylesheet is destroyed', 5 | inject(function($compile, $document, $window, $rootElement, $rootScope) { 6 | 7 | var doc = $document[0]; 8 | var count = doc.styleSheets.length; 9 | var stylesheet = createMockStyleSheet($document, $window); 10 | expect(doc.styleSheets.length).toBe(count + 1); 11 | 12 | angular.element(doc.body).append($rootElement); 13 | 14 | var elm = $compile('
...
')($rootScope); 15 | $rootElement.append(elm); 16 | 17 | expect(getStyle(elm, 'paddingTop')).toBe('0px'); 18 | 19 | stylesheet.addRule('.padded', 'padding-top:2px'); 20 | 21 | expect(getStyle(elm, 'paddingTop')).toBe('2px'); 22 | 23 | stylesheet.destroy(); 24 | 25 | expect(getStyle(elm, 'paddingTop')).toBe('0px'); 26 | 27 | function getStyle(element, key) { 28 | var node = element[0]; 29 | return node.currentStyle ? 30 | node.currentStyle[key] : 31 | $window.getComputedStyle(node)[key]; 32 | }; 33 | })); 34 | 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /src/ngScenario/matchers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Matchers for implementing specs. Follows the Jasmine spec conventions. 5 | */ 6 | 7 | angular.scenario.matcher('toEqual', function(expected) { 8 | return angular.equals(this.actual, expected); 9 | }); 10 | 11 | angular.scenario.matcher('toBe', function(expected) { 12 | return this.actual === expected; 13 | }); 14 | 15 | angular.scenario.matcher('toBeDefined', function() { 16 | return angular.isDefined(this.actual); 17 | }); 18 | 19 | angular.scenario.matcher('toBeTruthy', function() { 20 | return this.actual; 21 | }); 22 | 23 | angular.scenario.matcher('toBeFalsy', function() { 24 | return !this.actual; 25 | }); 26 | 27 | angular.scenario.matcher('toMatch', function(expected) { 28 | return new RegExp(expected).test(this.actual); 29 | }); 30 | 31 | angular.scenario.matcher('toBeNull', function() { 32 | return this.actual === null; 33 | }); 34 | 35 | angular.scenario.matcher('toContain', function(expected) { 36 | return includes(this.actual, expected); 37 | }); 38 | 39 | angular.scenario.matcher('toBeLessThan', function(expected) { 40 | return this.actual < expected; 41 | }); 42 | 43 | angular.scenario.matcher('toBeGreaterThan', function(expected) { 44 | return this.actual > expected; 45 | }); 46 | -------------------------------------------------------------------------------- /docs/src/templates/docs-scenario.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AngularJS Docs E2E Test Runner 5 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/ng/filter/orderBySpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Filter: orderBy', function() { 4 | var orderBy; 5 | beforeEach(inject(function($filter) { 6 | orderBy = $filter('orderBy'); 7 | })); 8 | 9 | it('should return same array if predicate is falsy', function() { 10 | var array = [1, 2, 3]; 11 | expect(orderBy(array)).toBe(array); 12 | }); 13 | 14 | it('shouldSortArrayInReverse', function() { 15 | expect(orderBy([{a:15}, {a:2}], 'a', true)).toEqualData([{a:15}, {a:2}]); 16 | expect(orderBy([{a:15}, {a:2}], 'a', "T")).toEqualData([{a:15}, {a:2}]); 17 | expect(orderBy([{a:15}, {a:2}], 'a', "reverse")).toEqualData([{a:15}, {a:2}]); 18 | }); 19 | 20 | it('should sort array by predicate', function() { 21 | expect(orderBy([{a:15, b:1}, {a:2, b:1}], ['a', 'b'])).toEqualData([{a:2, b:1}, {a:15, b:1}]); 22 | expect(orderBy([{a:15, b:1}, {a:2, b:1}], ['b', 'a'])).toEqualData([{a:2, b:1}, {a:15, b:1}]); 23 | expect(orderBy([{a:15, b:1}, {a:2, b:1}], ['+b', '-a'])).toEqualData([{a:15, b:1}, {a:2, b:1}]); 24 | }); 25 | 26 | it('should use function', function() { 27 | expect( 28 | orderBy( 29 | [{a:15, b:1},{a:2, b:1}], 30 | function(value) { return value.a; })). 31 | toEqual([{a:2, b:1},{a:15, b:1}]); 32 | }); 33 | 34 | }); 35 | -------------------------------------------------------------------------------- /test/ng/filterSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('$filter', function() { 4 | var $filterProvider, $filter; 5 | 6 | beforeEach(module(function(_$filterProvider_) { 7 | $filterProvider = _$filterProvider_; 8 | })); 9 | 10 | beforeEach(inject(function(_$filter_) { 11 | $filter = _$filter_; 12 | })); 13 | 14 | describe('provider', function() { 15 | it('should allow registration of filters', function() { 16 | var FooFilter = function() { 17 | return function() { return 'foo'; }; 18 | }; 19 | 20 | $filterProvider.register('foo', FooFilter); 21 | 22 | var fooFilter = $filter('foo'); 23 | expect(fooFilter()).toBe('foo'); 24 | }); 25 | 26 | it('should allow registration of a map of filters', function() { 27 | var FooFilter = function() { 28 | return function() { return 'foo'; }; 29 | }; 30 | 31 | var BarFilter = function() { 32 | return function() { return 'bar'; }; 33 | }; 34 | 35 | $filterProvider.register({ 36 | 'foo': FooFilter, 37 | 'bar': BarFilter 38 | }); 39 | 40 | var fooFilter = $filter('foo'); 41 | expect(fooFilter()).toBe('foo'); 42 | 43 | var barFilter = $filter('bar'); 44 | expect(barFilter()).toBe('bar'); 45 | }); 46 | }); 47 | }); -------------------------------------------------------------------------------- /lib/browser-stack/start-tunnel.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var http = require('http'); 3 | var BrowserStackTunnel = require('browserstacktunnel-wrapper'); 4 | 5 | var HOSTNAME = 'localhost'; 6 | var PORTS = require('../grunt/utils').availablePorts; 7 | var ACCESS_KEY = process.env.BROWSER_STACK_ACCESS_KEY; 8 | var READY_FILE = process.env.SAUCE_CONNECT_READY_FILE; 9 | 10 | // We need to start fake servers, otherwise the tunnel does not start. 11 | var fakeServers = []; 12 | var hosts = []; 13 | 14 | PORTS.forEach(function(port) { 15 | fakeServers.push(http.createServer(function() {}).listen(port)); 16 | hosts.push({ 17 | name: HOSTNAME, 18 | port: port, 19 | sslFlag: 0 20 | }); 21 | }); 22 | 23 | var tunnel = new BrowserStackTunnel({ 24 | key: ACCESS_KEY, 25 | hosts: hosts 26 | }); 27 | 28 | console.log('Starting tunnel on ports', PORTS.join(', ')); 29 | tunnel.start(function(error) { 30 | if (error) { 31 | console.error('Can not establish the tunnel', error); 32 | } else { 33 | console.log('Tunnel established.'); 34 | fakeServers.forEach(function(server) { 35 | server.close(); 36 | }); 37 | 38 | if (READY_FILE) { 39 | fs.writeFile(READY_FILE, ''); 40 | } 41 | } 42 | }); 43 | 44 | tunnel.on('error', function(error) { 45 | console.error(error); 46 | }); 47 | -------------------------------------------------------------------------------- /docs/content/error/compile/nonassign.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:nonassign 3 | @fullName Non-Assignable Expression 4 | @description 5 | 6 | This error occurs when a directive defines an isolate scope property 7 | (using the `=` mode in the {@link api/ng.$compile#description_comprehensive-directive-api_directive-definition-object 8 | `scope` option} of a directive definition) but the directive is used with an expression that is not-assignable. 9 | 10 | In order for the two-way data-binding to work, it must be possible to write new values back into the path defined with the expression. 11 | 12 | For example, given a directive: 13 | 14 | ``` 15 | myModule.directive('myDirective', function factory() { 16 | return { 17 | ... 18 | scope: { 19 | 'bind': '=localValue' 20 | } 21 | ... 22 | } 23 | }); 24 | ``` 25 | 26 | Following are invalid uses of this directive: 27 | ``` 28 | 29 | 30 | 31 | 32 | 33 | ``` 34 | 35 | 36 | To resolve this error, always use path expressions with scope properties that are two-way data-bound: 37 | ``` 38 | 39 | 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /test/ng/directive/ngEventDirsSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('event directives', function() { 4 | var element; 5 | 6 | 7 | afterEach(function() { 8 | dealoc(element); 9 | }); 10 | 11 | 12 | describe('ngSubmit', function() { 13 | 14 | it('should get called on form submit', inject(function($rootScope, $compile) { 15 | element = $compile('
' + 16 | '' + 17 | '
')($rootScope); 18 | $rootScope.$digest(); 19 | expect($rootScope.submitted).not.toBeDefined(); 20 | 21 | browserTrigger(element.children()[0]); 22 | expect($rootScope.submitted).toEqual(true); 23 | })); 24 | 25 | it('should expose event on form submit', inject(function($rootScope, $compile) { 26 | $rootScope.formSubmission = function(e) { 27 | if (e) { 28 | $rootScope.formSubmitted = 'foo'; 29 | } 30 | }; 31 | 32 | element = $compile('
' + 33 | '' + 34 | '
')($rootScope); 35 | $rootScope.$digest(); 36 | expect($rootScope.formSubmitted).not.toBeDefined(); 37 | 38 | browserTrigger(element.children()[0]); 39 | expect($rootScope.formSubmitted).toEqual('foo'); 40 | })); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /docs/content/error/compile/tplrt.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:tplrt 3 | @fullName Invalid Template Root 4 | @description 5 | 6 | When a directive is declared with `template` (or `templateUrl`) and `replace` mode on, the template 7 | must have exactly one root element. That is, the text of the template property or the content 8 | referenced by the templateUrl must be contained within a single html element. 9 | For example, `

blah blah blah

` instead of simply `blah blah blah`. 10 | Otherwise, the replacement operation would result in a single element (the directive) being replaced 11 | with multiple elements or nodes, which is unsupported and not commonly needed in practice. 12 | 13 | 14 | For example a directive with definition: 15 | 16 | ``` 17 | myModule.directive('myDirective', function factory() { 18 | return { 19 | ... 20 | replace: true, 21 | templateUrl: 'someUrl' 22 | ... 23 | } 24 | }); 25 | ``` 26 | 27 | And a template provided at URL `someUrl`. The template must be an html fragment that has only a 28 | single root element, like the `div` element in this template: 29 | 30 | ``` 31 |
Hello World!
32 | ``` 33 | 34 | An an invalid template to be used with this directive is one that defines multiple root nodes or 35 | elements. For example: 36 | 37 | ``` 38 | Hello World! 39 | ``` 40 | -------------------------------------------------------------------------------- /src/ng/directive/ngNonBindable.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc directive 5 | * @name ng.directive:ngNonBindable 6 | * @restrict AC 7 | * @priority 1000 8 | * 9 | * @description 10 | * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current 11 | * DOM element. This is useful if the element contains what appears to be Angular directives and 12 | * bindings but which should be ignored by Angular. This could be the case if you have a site that 13 | * displays snippets of code, for instance. 14 | * 15 | * @element ANY 16 | * 17 | * @example 18 | * In this example there are two locations where a simple interpolation binding (`{{}}`) is present, 19 | * but the one wrapped in `ngNonBindable` is left alone. 20 | * 21 | * @example 22 | 23 | 24 |
Normal: {{1 + 2}}
25 |
Ignored: {{1 + 2}}
26 |
27 | 28 | it('should check ng-non-bindable', function() { 29 | expect(using('.doc-example-live').binding('1 + 2')).toBe('3'); 30 | expect(using('.doc-example-live').element('div:last').text()). 31 | toMatch(/1 \+ 2/); 32 | }); 33 | 34 |
35 | */ 36 | var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); 37 | -------------------------------------------------------------------------------- /docs/content/guide/dev_guide.templates.css-styling.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name Developer Guide: Templates: Working With CSS in Angular 3 | @description 4 | 5 | 6 | Angular sets these CSS classes. It is up to your application to provide useful styling. 7 | 8 | # CSS classes used by angular 9 | 10 | * `ng-scope` 11 | - **Usage:** angular applies this class to any element that where a new {@link api/ng.$rootScope.Scope scope} 12 | is defined. (see {@link guide/scope scope} guide for more information about scopes) 13 | 14 | * `ng-binding` 15 | - **Usage:** angular applies this class to any element that is attached to a data binding, via `ng-bind` or 16 | {{}} curly braces, for example. (see {@link guide/databinding databinding} guide) 17 | 18 | * `ng-invalid`, `ng-valid` 19 | - **Usage:** angular applies this class to an input widget element if that element's input does 20 | not pass validation. (see {@link api/ng.directive:input input} directive) 21 | 22 | * `ng-pristine`, `ng-dirty` 23 | - **Usage:** angular {@link api/ng.directive:input input} directive applies `ng-pristine` class 24 | to a new input widget element which did not have user interaction. Once the user interacts with 25 | the input widget the class is changed to `ng-dirty`. 26 | 27 | 28 | ## Related Topics 29 | 30 | * {@link templates Angular Templates} 31 | * {@link forms Angular Forms} 32 | -------------------------------------------------------------------------------- /test/e2e/docsAppE2E.js: -------------------------------------------------------------------------------- 1 | describe('docs.angularjs.org', function () { 2 | describe('App', function () { 3 | // it('should filter the module list when searching', function () { 4 | // browser.get(); 5 | // browser.waitForAngular(); 6 | 7 | // var search = element(by.input('q')); 8 | // search.clear(); 9 | // search.sendKeys('ngBind'); 10 | 11 | // var firstModule = element(by.css('.search-results a')); 12 | // expect(firstModule.getText()).toEqual('ngBind'); 13 | // }); 14 | 15 | 16 | it('should change the page content when clicking a link to a service', function () { 17 | browser.get(''); 18 | 19 | var ngBindLink = element(by.css('.definition-table td a[href="api/ng.directive:ngClick"]')); 20 | ngBindLink.click(); 21 | 22 | var pageBody = element(by.css('.content h1 code')); 23 | expect(pageBody.getText()).toEqual('ngClick'); 24 | }); 25 | 26 | 27 | it('should show the functioning input directive example', function () { 28 | browser.get('index-nocache.html#!/api/ng.directive:input'); 29 | //Wait for animation 30 | browser.sleep(500); 31 | 32 | var nameInput = element(by.input('user.name')); 33 | nameInput.click(); 34 | nameInput.sendKeys('!!!'); 35 | 36 | var code = element(by.css('.doc-example-live tt')); 37 | expect(code.getText()).toContain('guest!!!'); 38 | }); 39 | }); 40 | }) 41 | -------------------------------------------------------------------------------- /test/ng/directive/scriptSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('scriptDirective', function() { 4 | var element; 5 | 6 | 7 | afterEach(function(){ 8 | dealoc(element); 9 | }); 10 | 11 | 12 | it('should populate $templateCache with contents of a ng-template script element', inject( 13 | function($compile, $templateCache) { 14 | $compile('
foo' + 15 | '' + 16 | '' + 17 | '
' ); 18 | expect($templateCache.get('/myTemplate.html')).toBe('{{y}}'); 19 | expect($templateCache.get('/ignore')).toBeUndefined(); 20 | } 21 | )); 22 | 23 | 24 | it('should not compile scripts', inject(function($compile, $templateCache, $rootScope) { 25 | var doc = jqLite('
'); 26 | // jQuery is too smart and removes script tags 27 | doc[0].innerHTML = 'foo' + 28 | '' + 29 | ''; 30 | 31 | $compile(doc)($rootScope); 32 | $rootScope.$digest(); 33 | 34 | var scripts = doc.find('script'); 35 | expect(scripts.eq(0)[0].text).toBe('some {{binding}}'); 36 | expect(scripts.eq(1)[0].text).toBe('other {{binding}}'); 37 | dealoc(doc); 38 | })); 39 | }); 40 | -------------------------------------------------------------------------------- /docs/content/cookbook/helloworld.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name Cookbook: Hello World 3 | @description 4 | 5 | 6 | 7 | 12 |
13 | Your name: 14 |
15 | Hello {{name || "World"}}! 16 |
17 |
18 | 19 | it('should change the binding when user enters text', function() { 20 | expect(binding('name')).toEqual('World'); 21 | input('name').enter('angular'); 22 | expect(binding('name')).toEqual('angular'); 23 | }); 24 | 25 |
26 | 27 | # Things to notice 28 | 29 | Take a look through the source and note: 30 | 31 | * The script tag that {@link guide/bootstrap bootstraps} the Angular environment. 32 | * The text {@link api/ng.directive:input input form control} which is 33 | bound to the greeting name text. 34 | * There is no need for listener registration and event firing on change events. 35 | * The implicit presence of the `name` variable which is in the root {@link api/ng.$rootScope.Scope scope}. 36 | * The double curly brace `{{markup}}`, which binds the name variable to the greeting text. 37 | * The concept of {@link guide/databinding data binding}, which reflects any 38 | changes to the 39 | input field in the greeting text. 40 | -------------------------------------------------------------------------------- /example/tweeter/tweeterclient.js: -------------------------------------------------------------------------------- 1 | function noop() {} 2 | $(document).ready(function() { 3 | function xhr(method, url, data, callback){ 4 | jQuery.getJSON(url, function() { 5 | callback.apply(this, arguments); 6 | scope.updateView(); 7 | }); 8 | } 9 | 10 | var resourceFactory = new ResourceFactory(xhr); 11 | 12 | var Tweeter = resourceFactory.route("http://twitter.com/statuses/:service:username.json", {}, { 13 | home: {method:'GET', params: {service:'home_timeline'}, isArray:true }, 14 | user: {method:'GET', params: {service:'user_timeline/'}, isArray:true } 15 | }); 16 | 17 | 18 | var scope = window.scope = angular.compile(document, { 19 | location:angular.startUrlWatcher() 20 | }); 21 | 22 | function fetchTweets(username){ 23 | return username ? Tweeter.user({username: username}) : Tweeter.home(); 24 | } 25 | 26 | scope.set('fetchTweets', fetchTweets); 27 | scope.set('users', [ 28 | {screen_name:'mhevery', name:'Mi\u0161ko Hevery', 29 | notes:'Author of http://www.getangular.com.', 30 | profile_image_url:'http://a3.twimg.com/profile_images/54360179/Me_-_Small_Banner_normal.jpg'}, 31 | {screen_name:'abrons', name:'Adam Abrons', 32 | notes:'Author of & Ruby guru see: http://www.angularjs.org.', 33 | profile_image_url:'http://media.linkedin.com/mpr/mpr/shrink_80_80/p/2/000/005/0a8/044278d.jpg'} 34 | ]); 35 | scope.init(); 36 | }); 37 | -------------------------------------------------------------------------------- /scripts/angular-phonecat/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script for updating angular-phonecat repo from current local build. 4 | 5 | echo "#################################" 6 | echo "## Update angular-phonecat ###" 7 | echo "#################################" 8 | 9 | ARG_DEFS=( 10 | "--action=(prepare|publish)" 11 | "[--no-test=(true|false)]" 12 | ) 13 | 14 | function init { 15 | TMP_DIR=$(resolveDir ../../tmp) 16 | BUILD_DIR=$(resolveDir ../../build) 17 | REPO_DIR=$TMP_DIR/angular-phonecat 18 | NEW_VERSION=$(cat $BUILD_DIR/version.txt) 19 | } 20 | 21 | function prepare { 22 | echo "-- Cloning angular-phonecat" 23 | git clone git@github.com:angular/angular-phonecat.git $REPO_DIR 24 | 25 | # 26 | # copy the files from the build 27 | # 28 | echo "-- Updating angular-phonecat" 29 | cd $REPO_DIR 30 | ./scripts/private/update-angular.sh $BUILD_DIR 31 | 32 | # Test 33 | if [[ $NO_TEST != "true" ]]; then 34 | ./scripts/private/test-all.sh 35 | fi 36 | 37 | # Generate demo 38 | ./scripts/private/snapshot-web.sh 39 | git checkout gh-pages 40 | git pull 41 | rm -r step* 42 | mv angular-phonecat-snapshots-web/step* . 43 | git add step* 44 | git commit -am "Angular $NEW_VERSION release" 45 | } 46 | 47 | function publish { 48 | cd $REPO_DIR 49 | echo "-- Pushing angular-phonecat" 50 | git push origin master -f --tags 51 | git push origin gh-pages -f 52 | } 53 | 54 | source $(dirname $0)/../utils.inc 55 | -------------------------------------------------------------------------------- /src/ng/exceptionHandler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc function 5 | * @name ng.$exceptionHandler 6 | * @requires $log 7 | * 8 | * @description 9 | * Any uncaught exception in angular expressions is delegated to this service. 10 | * The default implementation simply delegates to `$log.error` which logs it into 11 | * the browser console. 12 | * 13 | * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by 14 | * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. 15 | * 16 | * ## Example: 17 | * 18 | *
19 |  *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
20 |  *     return function (exception, cause) {
21 |  *       exception.message += ' (caused by "' + cause + '")';
22 |  *       throw exception;
23 |  *     };
24 |  *   });
25 |  * 
26 | * 27 | * This example will override the normal action of `$exceptionHandler`, to make angular 28 | * exceptions fail hard when they happen, instead of just logging to the console. 29 | * 30 | * @param {Error} exception Exception associated with the error. 31 | * @param {string=} cause optional information about the context in which 32 | * the error was thrown. 33 | * 34 | */ 35 | function $ExceptionHandlerProvider() { 36 | this.$get = ['$log', function($log) { 37 | return function(exception, cause) { 38 | $log.error.apply($log, arguments); 39 | }; 40 | }]; 41 | } 42 | -------------------------------------------------------------------------------- /jenkins_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "#################################" 4 | echo "#### Jenkins Build ############" 5 | echo "#################################" 6 | 7 | # Enable tracing and exit on first failure 8 | set -xe 9 | 10 | # Define reasonable set of browsers in case we are running manually from commandline 11 | if [[ -z "$BROWSERS" ]] 12 | then 13 | BROWSERS="Chrome,Firefox,Opera,/Users/jenkins/bin/safari.sh,/Users/jenkins/bin/ie8.sh,/Users/jenkins/bin/ie9.sh" 14 | fi 15 | 16 | if [[ -z "$BROWSERS_E2E" ]] 17 | then 18 | BROWSERS_E2E="Chrome,Firefox,/Users/jenkins/bin/safari.sh" 19 | fi 20 | 21 | 22 | # CLEAN # 23 | rm -f angular.min.js.gzip.size 24 | rm -f angular.js.size 25 | 26 | 27 | # BUILD # 28 | npm install --color false 29 | grunt ci-checks package --no-color 30 | 31 | # DOCS generator unit tests # 32 | grunt test:docgen --no-color 33 | 34 | # UNIT TESTS # 35 | grunt test:unit --browsers $BROWSERS --reporters=dots,junit --no-colors --no-color 36 | 37 | # END TO END TESTS # 38 | grunt test:e2e --browsers $BROWSERS_E2E --reporters=dots,junit --no-colors --no-color 39 | grunt test:protractor 40 | 41 | # Promises/A+ TESTS # 42 | grunt test:promises-aplus --no-color 43 | 44 | 45 | # CHECK SIZE # 46 | gzip -c < build/angular.min.js > build/angular.min.js.gzip 47 | echo "YVALUE=`ls -l build/angular.min.js | cut -d" " -f 8`" > angular.min.js.size 48 | echo "YVALUE=`ls -l build/angular.min.js.gzip | cut -d" " -f 8`" > angular.min.js.gzip.size 49 | -------------------------------------------------------------------------------- /scripts/jenkins/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "#################################" 4 | echo "#### Cut release ################" 5 | echo "#################################" 6 | 7 | ARG_DEFS=( 8 | "--next-version-type=(patch|minor|major)" 9 | "--next-version-name=(.+)" 10 | # require the git dryrun flag so the script can't be run without 11 | # thinking about this! 12 | "--git-push-dryrun=(true|false)" 13 | "[--no-test=(true|false)]" 14 | ) 15 | 16 | function init { 17 | NG_ARGS=("$@") 18 | if [[ ! $VERBOSE ]]; then 19 | VERBOSE=false 20 | fi 21 | if [[ ! $NO_TEST ]]; then 22 | NO_TEST=false 23 | fi 24 | VERBOSE_ARG="--verbose=$VERBOSE" 25 | NO_TEST_ARG="--no_test=$NO_TEST" 26 | } 27 | 28 | function phase { 29 | ACTION_ARG="--action=$1" 30 | ../angular.js/publish.sh $ACTION_ARG $VERBOSE_ARG $NO_TEST_ARG \ 31 | --next-version-type=$NEXT_VERSION_TYPE --next-version-name=$NEXT_VERSION_NAME 32 | ../code.angularjs.org/publish.sh $ACTION_ARG $VERBOSE_ARG 33 | ../bower/publish.sh $ACTION_ARG $VERBOSE_ARG 34 | ../angular-seed/publish.sh $ACTION_ARG $VERBOSE_ARG $NO_TEST_ARG 35 | ../angular-phonecat/publish.sh $ACTION_ARG $VERBOSE_ARG $NO_TEST_ARG 36 | } 37 | 38 | function run { 39 | # First prepare all scripts (build, test, commit, tag, ...), 40 | # so we are sure everything is all right 41 | phase prepare 42 | # only then publish to github 43 | phase publish 44 | } 45 | 46 | source $(dirname $0)/../utils.inc 47 | -------------------------------------------------------------------------------- /scripts/angularjs.org/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script for updating angularjs.org repo 3 | 4 | echo "#################################" 5 | echo "##### Update angularjs.org ######" 6 | echo "#################################" 7 | 8 | ARG_DEFS=( 9 | "--action=(prepare|publish)" 10 | "--cdn-version=(.*)" 11 | ) 12 | 13 | function init { 14 | TMP_DIR=$(resolveDir ../../tmp) 15 | REPO_DIR=$TMP_DIR/angularjs.org 16 | } 17 | 18 | function prepare { 19 | echo "-- Cloning angularjs.org" 20 | git clone git@github.com:angular/angularjs.org.git $REPO_DIR 21 | 22 | # 23 | # update files 24 | # 25 | echo "-- Updating angularjs.org" 26 | cd $REPO_DIR 27 | VERSION_REGEX="[a-z0-9\-\.\+]+" 28 | 29 | replaceInFile "index.html" "(ajax\/libs\/angularjs\/)$VERSION_REGEX" "\1$CDN_VERSION" 30 | replaceInFile "index.html" "([^<]*)$VERSION_REGEX" "\1$CDN_VERSION" 31 | replaceInFile "index.html" "(code.angularjs.org\/)$VERSION_REGEX" "\1$CDN_VERSION" 32 | 33 | replaceInFile "js/homepage.js" "($scope.CURRENT_STABLE_VERSION[ ]*=[ ]*')$VERSION_REGEX" "\1$CDN_VERSION" 34 | replaceInFile "js/homepage.js" "($scope.CURRENT_UNSTABLE_VERSION[ ]*=[ ]*')$VERSION_REGEX" "\1$CDN_VERSION" 35 | 36 | git add index.html 37 | git add js/homepage.js 38 | git commit -m "update(version): update angular version to $CDN_VERSION" 39 | } 40 | 41 | function publish { 42 | cd $REPO_DIR 43 | echo "-- Pushing angularjs.org" 44 | git push origin master 45 | } 46 | 47 | source $(dirname $0)/../utils.inc 48 | -------------------------------------------------------------------------------- /test/ngSanitize/filter/linkySpec.js: -------------------------------------------------------------------------------- 1 | describe('linky', function() { 2 | var linky; 3 | 4 | beforeEach(module('ngSanitize')); 5 | 6 | beforeEach(inject(function($filter){ 7 | linky = $filter('linky'); 8 | })); 9 | 10 | it('should do basic filter', function() { 11 | expect(linky("http://ab/ (http://a/) http://1.2/v:~-123. c")). 12 | toEqual('http://ab/ ' + 13 | '(http://a/) ' + 14 | '<http://a/> ' + 15 | 'http://1.2/v:~-123. c'); 16 | expect(linky(undefined)).not.toBeDefined(); 17 | }); 18 | 19 | it('should handle mailto:', function() { 20 | expect(linky("mailto:me@example.com")). 21 | toEqual('me@example.com'); 22 | expect(linky("me@example.com")). 23 | toEqual('me@example.com'); 24 | expect(linky("send email to me@example.com, but")). 25 | toEqual('send email to me@example.com, but'); 26 | }); 27 | 28 | it('should handle target:', function() { 29 | expect(linky("http://example.com", "_blank")). 30 | toEqual('http://example.com') 31 | expect(linky("http://example.com", "someNamedIFrame")). 32 | toEqual('http://example.com') 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /example/tweeter/style.css: -------------------------------------------------------------------------------- 1 | .loading {display: none;} 2 | .fetching .loading {display: block;} 3 | 4 | a { 5 | color: blue; 6 | } 7 | 8 | h1 { 9 | background-color: black; 10 | margin: 0; 11 | padding: .25em; 12 | color: white; 13 | border-bottom: 5px solid gray; 14 | } 15 | 16 | .box { 17 | border: 2px solid gray; 18 | } 19 | 20 | .tweeter { 21 | margin-right: 360px; 22 | } 23 | 24 | ul { 25 | list-style: none; 26 | margin: 0; 27 | padding: 0; 28 | } 29 | 30 | li { 31 | margin: .25em; 32 | padding: 2px; 33 | } 34 | 35 | li img { 36 | float: left; 37 | margin: 2px; 38 | margin-right: .5em; 39 | max-height: 48px; 40 | min-height: 48px; 41 | } 42 | 43 | li.even { 44 | background-color: lightgray; 45 | } 46 | 47 | 48 | .addressbook { 49 | float: right; 50 | width: 350px; 51 | } 52 | 53 | .addressbook li { 54 | font-size: .9em; 55 | } 56 | 57 | .clrleft { 58 | clear: left; 59 | } 60 | 61 | .notes { 62 | font-size: .8em; 63 | color: gray; 64 | } 65 | 66 | .username, .nickname { 67 | font-weight: bold; 68 | } 69 | 70 | .editor { 71 | padding: 4px; 72 | } 73 | 74 | label { 75 | color: gray; 76 | display: inline-block; 77 | width: 75px; 78 | text-align: right; 79 | padding: 2px; 80 | margin-top: 10px; 81 | } 82 | 83 | .editor input[type=text], 84 | .editor textarea { 85 | width: 230px; 86 | vertical-align: text-top; 87 | } 88 | 89 | .editor TEXTAREA { 90 | height: 50px; 91 | } 92 | 93 | .debug{ 94 | font-size: .7em; 95 | white-space: pre; 96 | padding: 0; 97 | margin: 0; 98 | } -------------------------------------------------------------------------------- /docs/src/templates/css/animations.css: -------------------------------------------------------------------------------- 1 | .reveal.ng-enter { 2 | -webkit-transition:1s linear all; 3 | -moz-transition:1s linear all; 4 | -o-transition:1s linear all; 5 | transition:1s linear all; 6 | 7 | opacity:0; 8 | } 9 | .reveal.ng-enter.ng-enter-active { 10 | opacity:1; 11 | } 12 | 13 | .nav-list { 14 | padding: 0; 15 | } 16 | 17 | .nav-list li { 18 | margin:0!important; 19 | padding:2px 15px; 20 | overflow:hidden; 21 | line-height:1.1em; 22 | } 23 | 24 | .slide-reveal.ng-enter { 25 | -webkit-transition:0.5s linear all; 26 | -moz-transition:0.5s linear all; 27 | -o-transition:0.5s linear all; 28 | transition:0.5s linear all; 29 | 30 | opacity:0.5; 31 | position:relative; 32 | opacity:0; 33 | top:10px; 34 | } 35 | .slide-reveal.ng-enter.ng-enter-active { 36 | top:0; 37 | opacity:1; 38 | } 39 | 40 | .foldout.ng-enter, 41 | .foldout.ng-move, 42 | .foldout.ng-hide-add, 43 | .foldout.ng-hide-remove { 44 | -webkit-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; 45 | -moz-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; 46 | -o-transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; 47 | transition:0.3s cubic-bezier(0.250, 0.460, 0.450, 0.940) all; 48 | } 49 | 50 | .foldout.ng-hide-remove, 51 | .foldout.ng-hide-add.ng-hide-active, 52 | .foldout.ng-enter, 53 | .foldout.ng-move { 54 | opacity:0; 55 | } 56 | 57 | .foldout.ng-move.ng-move-active, 58 | .foldout.ng-hide-remove.ng-hide-remove-active, 59 | .foldout.ng-hide-add, 60 | .foldout.ng-enter.ng-enter-active { 61 | opacity:1; 62 | } 63 | -------------------------------------------------------------------------------- /example/buzz/buzz.js: -------------------------------------------------------------------------------- 1 | angular.module.ng('myApplication', function($resource){ 2 | this.Activity = $resource( 3 | 'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments', 4 | {alt:'json', callback:'JSON_CALLBACK'}, 5 | { 6 | get: {method:'JSON', params:{visibility:'@self'}}, 7 | replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}} 8 | }); 9 | }, {inject:['$resource']}); 10 | 11 | function BuzzController() { 12 | this.$watch('$location.hashPath', this.userChange); 13 | } 14 | BuzzController.prototype = { 15 | userChange: function() { 16 | this.userId = this.$location.hashPath; 17 | this.activities = this.Activity.get({userId:this.userId}); 18 | }, 19 | 20 | expandReplies: function(activity) { 21 | var self = this; 22 | if (activity.replies) { 23 | activity.replies.show = !activity.replies.show; 24 | } else { 25 | activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id}, function() { 26 | activity.replies.show = true; 27 | }); 28 | } 29 | } 30 | }; 31 | 32 | angular.widget('my:expand', function(element){ 33 | element.css('display', 'block'); 34 | this.descend(true); 35 | return function(element) { 36 | element.hide(); 37 | var watch = element.attr('expand'); 38 | this.$watch(watch, function(value){ 39 | if (value) { 40 | element.delay(0).slideDown('slow'); 41 | } else { 42 | element.slideUp('slow'); 43 | } 44 | }); 45 | }; 46 | }); 47 | -------------------------------------------------------------------------------- /docs/content/tutorial/step_01.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name Tutorial: 1 - Static Template 3 | @description 4 | 5 |
    6 | 7 | 8 | In order to illustrate how Angular enhances standard HTML, you will create a purely *static* HTML 9 | page and then examine how we can turn this HTML code into a template that Angular will use to 10 | dynamically display the same result with any set of data. 11 | 12 | In this step you will add some basic information about two cell phones to an HTML page. 13 | 14 | 15 |
    16 | 17 | 18 | The page now contains a list with information about two phones. 19 | 20 | The most important changes are listed below. You can see the full diff on {@link 21 | https://github.com/angular/angular-phonecat/compare/step-0...step-1 GitHub}: 22 | 23 | __`app/index.html`:__ 24 |
    25 |   
      26 |
    • 27 | Nexus S 28 |

      29 | Fast just got faster with Nexus S. 30 |

      31 |
    • 32 |
    • 33 | Motorola XOOM™ with Wi-Fi 34 |

      35 | The Next, Next Generation tablet. 36 |

      37 |
    • 38 |
    39 |
    40 | 41 | 42 | # Experiments 43 | 44 | * Try adding more static HTML to `index.html`. For example: 45 | 46 |

    Total number of phones: 2

    47 | 48 | 49 | # Summary 50 | 51 | This addition to your app uses static HTML to display the list. Now, let's go to {@link step_02 52 | step 2} to learn how to use AngularJS to dynamically generate the same list. 53 | 54 | 55 |
      56 | -------------------------------------------------------------------------------- /test/ng/directive/ngInitSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('ngInit', function() { 4 | var element; 5 | 6 | 7 | afterEach(function() { 8 | dealoc(element); 9 | }); 10 | 11 | 12 | it("should init model", inject(function($rootScope, $compile) { 13 | element = $compile('
      ')($rootScope); 14 | expect($rootScope.a).toEqual(123); 15 | })); 16 | 17 | 18 | it("should be evaluated before ngInclude", inject(function($rootScope, $templateCache, $compile) { 19 | $templateCache.put('template1.tpl', '1'); 20 | $templateCache.put('template2.tpl', '2'); 21 | $rootScope.template = 'template1.tpl'; 22 | element = $compile('
      ')($rootScope); 24 | $rootScope.$digest(); 25 | expect($rootScope.template).toEqual('template2.tpl'); 26 | expect(element.find('span').text()).toEqual('2'); 27 | })); 28 | 29 | 30 | it("should be evaluated after ngController", function() { 31 | module(function($controllerProvider) { 32 | $controllerProvider.register('TestCtrl', function($scope) {}); 33 | }); 34 | inject(function($rootScope, $compile) { 35 | element = $compile('
      ')($rootScope); 37 | $rootScope.$digest(); 38 | expect($rootScope.test).toBeUndefined(); 39 | expect(element.children('div').scope().test).toEqual(123); 40 | }); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /test/ngScenario/ScenarioSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe("ScenarioSpec: Compilation", function() { 4 | var element; 5 | 6 | afterEach(function() { 7 | dealoc(element); 8 | }); 9 | 10 | 11 | describe('compilation', function() { 12 | it("should compile dom node and return scope", inject(function($rootScope, $compile) { 13 | var node = jqLite('
      {{b=a+1}}
      ')[0]; 14 | element = $compile(node)($rootScope); 15 | $rootScope.$digest(); 16 | expect($rootScope.a).toEqual(1); 17 | expect($rootScope.b).toEqual(2); 18 | })); 19 | 20 | it("should compile jQuery node and return scope", inject(function($rootScope, $compile) { 21 | element = $compile(jqLite('
      {{a=123}}
      '))($rootScope); 22 | $rootScope.$digest(); 23 | expect(jqLite(element).text()).toEqual('123'); 24 | })); 25 | 26 | it("should compile text node and return scope", inject(function($rootScope, $compile) { 27 | element = $compile('
      {{a=123}}
      ')($rootScope); 28 | $rootScope.$digest(); 29 | expect(jqLite(element).text()).toEqual('123'); 30 | })); 31 | }); 32 | 33 | describe('jQuery', function () { 34 | it('should exist on the angular.scenario object', function () { 35 | expect(angular.scenario.jQuery).toBeDefined(); 36 | }); 37 | 38 | it('should have common jQuery methods', function () { 39 | var jQuery = angular.scenario.jQuery; 40 | expect(typeof jQuery).toEqual('function'); 41 | expect(typeof jQuery('
      ').html).toEqual('function'); 42 | }) 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /src/ng/directive/a.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc directive 5 | * @name ng.directive:a 6 | * @restrict E 7 | * 8 | * @description 9 | * Modifies the default behavior of the html A tag so that the default action is prevented when 10 | * the href attribute is empty. 11 | * 12 | * This change permits the easy creation of action links with the `ngClick` directive 13 | * without changing the location or causing page reloads, e.g.: 14 | * `Add Item` 15 | */ 16 | var htmlAnchorDirective = valueFn({ 17 | restrict: 'E', 18 | compile: function(element, attr) { 19 | 20 | if (msie <= 8) { 21 | 22 | // turn link into a stylable link in IE 23 | // but only if it doesn't have name attribute, in which case it's an anchor 24 | if (!attr.href && !attr.name) { 25 | attr.$set('href', ''); 26 | } 27 | 28 | // add a comment node to anchors to workaround IE bug that causes element content to be reset 29 | // to new attribute content if attribute is updated with value containing @ and element also 30 | // contains value with @ 31 | // see issue #1949 32 | element.append(document.createComment('IE fix')); 33 | } 34 | 35 | if (!attr.href && !attr.name) { 36 | return function(scope, element) { 37 | element.on('click', function(event){ 38 | // if we have no href url, then don't navigate anywhere. 39 | if (!element.attr('href')) { 40 | event.preventDefault(); 41 | } 42 | }); 43 | }; 44 | } 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /test/ng/directive/ngNonBindableSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | describe('ngNonBindable', function() { 5 | var element; 6 | 7 | 8 | afterEach(function(){ 9 | dealoc(element); 10 | }); 11 | 12 | 13 | it('should prevent compilation of the owning element and its children', 14 | inject(function($rootScope, $compile) { 15 | element = $compile('
      ')($rootScope); 16 | element = $compile('
      ' + 17 | ' {{a}}' + 18 | ' ' + 19 | '
      ' + 20 | ' {{b}}' + 21 | '
      ' + 22 | ' {{a}}' + 23 | ' ' + 24 | '
      ')($rootScope); 25 | $rootScope.a = "one"; 26 | $rootScope.b = "two"; 27 | $rootScope.$digest(); 28 | // Bindings not contained by ng-non-bindable should resolve. 29 | var spans = element.find("span"); 30 | expect(spans.eq(0).text()).toEqual('one'); 31 | expect(spans.eq(1).text()).toEqual('two'); 32 | expect(spans.eq(3).text()).toEqual('one'); 33 | expect(spans.eq(4).text()).toEqual('two'); 34 | // Bindings contained by ng-non-bindable should be left alone. 35 | var nonBindableDiv = element.find("div"); 36 | expect(nonBindableDiv.attr('foo')).toEqual('{{a}}'); 37 | expect(trim(nonBindableDiv.text())).toEqual('{{b}}'); 38 | })); 39 | }); 40 | -------------------------------------------------------------------------------- /src/ng/window.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc object 5 | * @name ng.$window 6 | * 7 | * @description 8 | * A reference to the browser's `window` object. While `window` 9 | * is globally available in JavaScript, it causes testability problems, because 10 | * it is a global variable. In angular we always refer to it through the 11 | * `$window` service, so it may be overridden, removed or mocked for testing. 12 | * 13 | * Expressions, like the one defined for the `ngClick` directive in the example 14 | * below, are evaluated with respect to the current scope. Therefore, there is 15 | * no risk of inadvertently coding in a dependency on a global value in such an 16 | * expression. 17 | * 18 | * @example 19 | 20 | 21 | 29 |
      30 | 31 | 32 |
      33 |
      34 | 35 | it('should display the greeting in the input box', function() { 36 | input('greeting').enter('Hello, E2E Tests'); 37 | // If we click the button it will block the test runner 38 | // element(':button').click(); 39 | }); 40 | 41 |
      42 | */ 43 | function $WindowProvider(){ 44 | this.$get = valueFn(window); 45 | } 46 | -------------------------------------------------------------------------------- /test/ng/directive/ngCloakSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('ngCloak', function() { 4 | var element; 5 | 6 | 7 | afterEach(function() { 8 | dealoc(element); 9 | }); 10 | 11 | 12 | it('should get removed when an element is compiled', inject(function($rootScope, $compile) { 13 | element = jqLite('
      '); 14 | expect(element.attr('ng-cloak')).toBe(''); 15 | $compile(element); 16 | expect(element.attr('ng-cloak')).toBeUndefined(); 17 | })); 18 | 19 | 20 | it('should remove ngCloak class from a compiled element with attribute', inject( 21 | function($rootScope, $compile) { 22 | element = jqLite('
      '); 23 | 24 | expect(element.hasClass('foo')).toBe(true); 25 | expect(element.hasClass('ng-cloak')).toBe(true); 26 | expect(element.hasClass('bar')).toBe(true); 27 | 28 | $compile(element); 29 | 30 | expect(element.hasClass('foo')).toBe(true); 31 | expect(element.hasClass('ng-cloak')).toBe(false); 32 | expect(element.hasClass('bar')).toBe(true); 33 | })); 34 | 35 | 36 | it('should remove ngCloak class from a compiled element', inject(function($rootScope, $compile) { 37 | element = jqLite('
      '); 38 | 39 | expect(element.hasClass('foo')).toBe(true); 40 | expect(element.hasClass('ng-cloak')).toBe(true); 41 | expect(element.hasClass('bar')).toBe(true); 42 | 43 | $compile(element); 44 | 45 | expect(element.hasClass('foo')).toBe(true); 46 | expect(element.hasClass('ng-cloak')).toBe(false); 47 | expect(element.hasClass('bar')).toBe(true); 48 | })); 49 | }); 50 | -------------------------------------------------------------------------------- /src/ngRoute/routeParams.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | ngRouteModule.provider('$routeParams', $RouteParamsProvider); 4 | 5 | 6 | /** 7 | * @ngdoc object 8 | * @name ngRoute.$routeParams 9 | * @requires $route 10 | * 11 | * @description 12 | * The `$routeParams` service allows you to retrieve the current set of route parameters. 13 | * 14 | * Requires the {@link ngRoute `ngRoute`} module to be installed. 15 | * 16 | * The route parameters are a combination of {@link ng.$location `$location`}'s 17 | * {@link ng.$location#methods_search `search()`} and {@link ng.$location#methods_path `path()`}. 18 | * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched. 19 | * 20 | * In case of parameter name collision, `path` params take precedence over `search` params. 21 | * 22 | * The service guarantees that the identity of the `$routeParams` object will remain unchanged 23 | * (but its properties will likely change) even when a route change occurs. 24 | * 25 | * Note that the `$routeParams` are only updated *after* a route change completes successfully. 26 | * This means that you cannot rely on `$routeParams` being correct in route resolve functions. 27 | * Instead you can use `$route.current.params` to access the new route's parameters. 28 | * 29 | * @example 30 | *
      31 |  *  // Given:
      32 |  *  // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
      33 |  *  // Route: /Chapter/:chapterId/Section/:sectionId
      34 |  *  //
      35 |  *  // Then
      36 |  *  $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
      37 |  * 
      38 | */ 39 | function $RouteParamsProvider() { 40 | this.$get = function() { return {}; }; 41 | } 42 | -------------------------------------------------------------------------------- /test/ng/localeSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('$locale', function() { 4 | 5 | var $locale = new $LocaleProvider().$get(); 6 | 7 | it('should have locale id set to en-us', function() { 8 | expect($locale.id).toBe('en-us'); 9 | }); 10 | 11 | 12 | it('should have NUMBER_FORMATS', function() { 13 | var numberFormats = $locale.NUMBER_FORMATS; 14 | expect(numberFormats).toBeDefined(); 15 | expect(numberFormats.PATTERNS.length).toBe(2); 16 | angular.forEach(numberFormats.PATTERNS, function(pattern) { 17 | expect(pattern.minInt).toBeDefined(); 18 | expect(pattern.minFrac).toBeDefined(); 19 | expect(pattern.maxFrac).toBeDefined(); 20 | expect(pattern.posPre).toBeDefined(); 21 | expect(pattern.posSuf).toBeDefined(); 22 | expect(pattern.negPre).toBeDefined(); 23 | expect(pattern.negSuf).toBeDefined(); 24 | expect(pattern.gSize).toBeDefined(); 25 | expect(pattern.lgSize).toBeDefined(); 26 | }); 27 | }); 28 | 29 | 30 | it('should have DATETIME_FORMATS', function() { 31 | var datetime = $locale.DATETIME_FORMATS; 32 | expect(datetime).toBeDefined(); 33 | expect(datetime.DAY.length).toBe(7); 34 | expect(datetime.SHORTDAY.length).toBe(7); 35 | expect(datetime.SHORTMONTH.length).toBe(12); 36 | expect(datetime.MONTH.length).toBe(12); 37 | expect(datetime.AMPMS.length).toBe(2); 38 | }); 39 | 40 | 41 | it('should return correct plural types', function() { 42 | expect($locale.pluralCat(-1)).toBe('other'); 43 | expect($locale.pluralCat(0)).toBe('other'); 44 | expect($locale.pluralCat(2)).toBe('other'); 45 | expect($locale.pluralCat(1)).toBe('one'); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /i18n/e2e/localeTest_zh.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | locale test 6 | 7 | 8 | 17 | 18 | 19 |

      Datetime/Number/Currency filters demo:

      20 |
      21 | date(medium): {{input | date:"medium"}}
      22 | date(longDate): {{input | date:"longDate"}}
      23 | number: {{input | number}}
      24 | currency: {{input | currency }} 25 |
      26 |

      Pluralization demo:

      27 |
      28 | 30 | 31 |
      32 |

      Pluralization demo with offsets:

      33 | Name of person1:
      34 | Name of person2:
      35 |
      36 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /test/ngScenario/output/xmlSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('angular.scenario.output.xml', function() { 4 | var output, context; 5 | var runner, model, $window; 6 | var spec, step; 7 | 8 | beforeEach(function() { 9 | $window = {}; 10 | context = _jQuery('
      '); 11 | runner = new angular.scenario.testing.MockRunner(); 12 | model = new angular.scenario.ObjectModel(runner); 13 | output = angular.scenario.output.xml(context, runner, model); 14 | spec = { 15 | name: 'test spec', 16 | definition: { 17 | id: 10, 18 | name: 'describe' 19 | } 20 | }; 21 | step = { 22 | name: 'some step', 23 | line: function() { return 'unknown:-1'; } 24 | }; 25 | }); 26 | 27 | it('should create XML nodes for object model', function() { 28 | runner.emit('SpecBegin', spec); 29 | runner.emit('StepBegin', spec, step); 30 | runner.emit('StepEnd', spec, step); 31 | runner.emit('SpecEnd', spec); 32 | runner.emit('RunnerEnd'); 33 | expect(context.find('it').attr('status')).toEqual('success'); 34 | expect(context.find('it step').attr('status')).toEqual('success'); 35 | }); 36 | 37 | it('should output errors to the XML', function() { 38 | runner.emit('SpecBegin', spec); 39 | runner.emit('StepBegin', spec, step); 40 | runner.emit('StepFailure', spec, step, 'error reason'); 41 | runner.emit('StepEnd', spec, step); 42 | runner.emit('SpecEnd', spec); 43 | runner.emit('RunnerEnd'); 44 | 45 | expect(context.find('it').attr('status')).toEqual('failure'); 46 | expect(context.find('it step').attr('status')).toEqual('failure'); 47 | expect(context.find('it step').text()).toEqual('error reason'); 48 | }); 49 | }); 50 | -------------------------------------------------------------------------------- /docs/content/error/sce/insecurl.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $sce:insecurl 3 | @fullName Processing of a Resource from Untrusted Source Blocked 4 | @description 5 | 6 | AngularJS' {@link api/ng.$sce Strict Contextual Escaping (SCE)} mode (enabled by default) has blocked loading a resource from an insecure URL. 7 | 8 | Typically, this would occur if you're attempting to load an Angular template from an untrusted source. 9 | It's also possible that a custom directive threw this error for a similar reason. 10 | 11 | Angular only loads templates from trusted URLs (by calling {@link api/ng.$sce#methods_getTrustedResourceUrl $sce.getTrustedResourceUrl} on the template URL). 12 | 13 | By default, only URLs that belong to the same origin are trusted. These are urls with the same domain and protocol as the application document. 14 | 15 | The {@link api/ng.directive:ngInclude ngInclude} directive and {@link guide/directive directives} that specify a `templateUrl` require a trusted resource URL. 16 | 17 | To load templates from other domains and/or protocols, either adjust the {@link 18 | api/ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelist}/ {@link 19 | api/ng.$sceDelegateProvider#methods_resourceUrlBlacklist blacklist} or wrap the URL with a call to {@link 20 | api/ng.$sce#methods_trustAsResourceUrl $sce.trustAsResourceUrl}. 21 | 22 | **Note**: The browser's {@link 23 | https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest Same Origin 24 | Policy} and {@link http://www.w3.org/TR/cors/ Cross-Origin Resource Sharing (CORS)} policy apply 25 | that may further restrict whether the template is successfully loaded. (e.g. neither cross-domain 26 | requests won't work on all browsers nor `file://` requests on some browsers) 27 | -------------------------------------------------------------------------------- /docs/component-spec/syntaxSpec.js: -------------------------------------------------------------------------------- 1 | describe('Docs Syntax', function() { 2 | 3 | beforeEach(module('bootstrap')); 4 | 5 | describe('syntax', function() { 6 | 7 | var id, element, document; 8 | 9 | beforeEach(inject(function($compile, $rootScope, $document) { 10 | document = $document[0]; 11 | //create the HTML elements missing in IE8 for this directive 12 | document.createElement('nav'); 13 | 14 | element = angular.element( 15 | '
      ' + 16 | '
      ' +
      20 |           '
      ' + 21 | '
      ' 22 | ); 23 | $compile(element)($rootScope); 24 | $rootScope.$digest(); 25 | 26 | element = element[0]; 27 | document.body.appendChild(element); 28 | })); 29 | 30 | it("should properly prepare a github link in the page", function() { 31 | var github = element.querySelector('.syntax-github'); 32 | expect(github.innerHTML).toMatch(/View on Github/i); 33 | expect(github.getAttribute('href')).toBe('gh-url'); 34 | }); 35 | 36 | it("should properly prepare a plunkr link in the page", function() { 37 | var plunkr = element.querySelector('.syntax-plunkr'); 38 | expect(plunkr.innerHTML).toMatch(/View on Plunkr/i); 39 | expect(plunkr.getAttribute('href')).toBe('pl-url'); 40 | }); 41 | 42 | it("should properly prepare a jsfiddle link in the page", function() { 43 | var jsfiddle = element.querySelector('.syntax-jsfiddle'); 44 | expect(jsfiddle.innerHTML).toMatch(/View on JSFiddle/i); 45 | expect(jsfiddle.getAttribute('href')).toBe('jf-url'); 46 | }); 47 | 48 | }); 49 | 50 | }); 51 | -------------------------------------------------------------------------------- /lib/sauce/sauce_connect_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Setup and start Sauce Connect for your TravisCI build 6 | # This script requires your .travis.yml to include the following two private env variables: 7 | # SAUCE_USERNAME 8 | # SAUCE_ACCESS_KEY 9 | # Follow the steps at https://saucelabs.com/opensource/travis to set that up. 10 | # 11 | # Curl and run this script as part of your .travis.yml before_script section: 12 | # before_script: 13 | # - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash 14 | 15 | CONNECT_URL="http://saucelabs.com/downloads/Sauce-Connect-latest.zip" 16 | CONNECT_DIR="/tmp/sauce-connect-$RANDOM" 17 | CONNECT_DOWNLOAD="Sauce_Connect.zip" 18 | 19 | CONNECT_LOG="$LOGS_DIR/sauce-connect" 20 | CONNECT_STDOUT="$LOGS_DIR/sauce-connect.stdout" 21 | CONNECT_STDERR="$LOGS_DIR/sauce-connect.stderr" 22 | 23 | # Get Connect and start it 24 | mkdir -p $CONNECT_DIR 25 | cd $CONNECT_DIR 26 | curl $CONNECT_URL -o $CONNECT_DOWNLOAD 2> /dev/null 1> /dev/null 27 | unzip $CONNECT_DOWNLOAD > /dev/null 28 | rm $CONNECT_DOWNLOAD 29 | 30 | SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev` 31 | 32 | 33 | ARGS="" 34 | 35 | # Set tunnel-id only on Travis, to make local testing easier. 36 | if [ ! -z "$TRAVIS_JOB_NUMBER" ]; then 37 | ARGS="$ARGS --tunnel-identifier $TRAVIS_JOB_NUMBER" 38 | fi 39 | if [ ! -z "$BROWSER_PROVIDER_READY_FILE" ]; then 40 | ARGS="$ARGS --readyfile $BROWSER_PROVIDER_READY_FILE" 41 | fi 42 | 43 | 44 | echo "Starting Sauce Connect in the background, logging into:" 45 | echo " $CONNECT_LOG" 46 | echo " $CONNECT_STDOUT" 47 | echo " $CONNECT_STDERR" 48 | java -jar Sauce-Connect.jar $ARGS $SAUCE_USERNAME $SAUCE_ACCESS_KEY \ 49 | --logfile $CONNECT_LOG 2> $CONNECT_STDERR 1> $CONNECT_STDOUT & 50 | -------------------------------------------------------------------------------- /docs/content/error/compile/ctreq.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc error 2 | @name $compile:ctreq 3 | @fullName Missing Required Controller 4 | @description 5 | 6 | This error occurs when {@link api/ng.$compile HTML compiler} tries to process a directive that specifies the {@link api/ng.$compile#description_comprehensive-directive-api_directive-definition-object `require` option} in a {@link api/ng.$compile#description_comprehensive-directive-api directive definition}, 7 | but the required directive controller is not present on the current DOM element (or its ancestor element, if `^` was specified). 8 | 9 | To resolve this error ensure that there is no typo in the required controller name and that the required directive controller is present on the current element. 10 | 11 | If the required controller is expected to be on a ancestor element, make ensure that you prefix the controller name in the `require` definition with `^`. 12 | 13 | If the required controller is optionally requested, use `?` or `^?` to specify that. 14 | 15 | 16 | Example of a directive that requires {@link api/ng.directive:ngModel ngModel} controller: 17 | ``` 18 | myApp.directive('myDirective', function() { 19 | return { 20 | require: 'ngModel', 21 | ... 22 | } 23 | } 24 | ``` 25 | 26 | This directive can then be used as: 27 | ``` 28 | 29 | ``` 30 | 31 | 32 | Example of a directive that optionally requires a {@link api/ng.directive:form form} controller from an ancestor: 33 | ``` 34 | myApp.directive('myDirective', function() { 35 | return { 36 | require: '^?form', 37 | ... 38 | } 39 | } 40 | ``` 41 | 42 | This directive can then be used as: 43 | ``` 44 |
      45 |
      46 | 47 |
      48 |
      49 | ``` 50 | -------------------------------------------------------------------------------- /src/apis.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | /** 5 | * Computes a hash of an 'obj'. 6 | * Hash of a: 7 | * string is string 8 | * number is number as string 9 | * object is either result of calling $$hashKey function on the object or uniquely generated id, 10 | * that is also assigned to the $$hashKey property of the object. 11 | * 12 | * @param obj 13 | * @returns {string} hash string such that the same input will have the same hash string. 14 | * The resulting string key is in 'type:hashKey' format. 15 | */ 16 | function hashKey(obj) { 17 | var objType = typeof obj, 18 | key; 19 | 20 | if (objType == 'object' && obj !== null) { 21 | if (typeof (key = obj.$$hashKey) == 'function') { 22 | // must invoke on object to keep the right this 23 | key = obj.$$hashKey(); 24 | } else if (key === undefined) { 25 | key = obj.$$hashKey = nextUid(); 26 | } 27 | } else { 28 | key = obj; 29 | } 30 | 31 | return objType + ':' + key; 32 | } 33 | 34 | /** 35 | * HashMap which can use objects as keys 36 | */ 37 | function HashMap(array){ 38 | forEach(array, this.put, this); 39 | } 40 | HashMap.prototype = { 41 | /** 42 | * Store key value pair 43 | * @param key key to store can be any type 44 | * @param value value to store can be any type 45 | */ 46 | put: function(key, value) { 47 | this[hashKey(key)] = value; 48 | }, 49 | 50 | /** 51 | * @param key 52 | * @returns the value for the key 53 | */ 54 | get: function(key) { 55 | return this[hashKey(key)]; 56 | }, 57 | 58 | /** 59 | * Remove the key/value pair 60 | * @param key 61 | */ 62 | remove: function(key) { 63 | var value = this[key = hashKey(key)]; 64 | delete this[key]; 65 | return value; 66 | } 67 | }; 68 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angularjs", 3 | "version": "1.2.9-snapshot", 4 | "cdnVersion": "1.2.8", 5 | "codename": "enchanted-articulacy", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/angular/angular.js.git" 9 | }, 10 | "devDependencies": { 11 | "grunt": "~0.4.1", 12 | "bower": "~1.2.2", 13 | "grunt-bump": "~0.0.13", 14 | "grunt-contrib-clean": "~0.5.0", 15 | "grunt-contrib-compress": "~0.5.2", 16 | "grunt-contrib-connect": "~0.5.0", 17 | "grunt-contrib-copy": "~0.4.1", 18 | "jasmine-node": "~1.11.0", 19 | "q": "~0.9.2", 20 | "q-io": "~1.10.6", 21 | "qq": "~0.3.5", 22 | "shelljs": "~0.2.6", 23 | "karma": "0.11.12", 24 | "karma-jasmine": "0.1.5", 25 | "karma-chrome-launcher": "0.1.2", 26 | "karma-firefox-launcher": "0.1.3", 27 | "karma-ng-scenario": "0.1.0", 28 | "karma-junit-reporter": "0.2.1", 29 | "karma-sauce-launcher": "0.2.0", 30 | "karma-script-launcher": "0.1.0", 31 | "karma-browserstack-launcher": "0.0.7", 32 | "protractor": "~0.16.1", 33 | "yaml-js": "~0.0.8", 34 | "marked": "0.2.9", 35 | "rewire": "1.1.3", 36 | "grunt-jasmine-node": "git://github.com/vojtajina/grunt-jasmine-node.git#fix-grunt-exit-code", 37 | "grunt-parallel": "~0.3.1", 38 | "grunt-ddescribe-iit": "~0.0.1", 39 | "grunt-merge-conflict": "~0.0.1", 40 | "promises-aplus-tests": "~1.3.2", 41 | "grunt-shell": "~0.4.0", 42 | "semver": "~2.1.0", 43 | "lodash": "~2.1.0", 44 | "browserstacktunnel-wrapper": "~1.1.1" 45 | }, 46 | "licenses": [ 47 | { 48 | "type": "MIT", 49 | "url": "https://github.com/angular/angular.js/blob/master/LICENSE" 50 | } 51 | ], 52 | "dependencies": { 53 | "grunt-contrib-jshint": "~0.7.2" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /example/tweeter/tweeter_demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | (TODO: I should fetch current tweets) 13 |
      14 |

      Tweets: {{$anchor.user}}

      15 | [ Filter: (TODO: this should act as search box) 16 | | << All 17 | ] 18 |
      Loading...
      19 | 31 |
      32 |
      tweets=(TODO: display me!!!)
      33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/src/templates/css/prettify.css: -------------------------------------------------------------------------------- 1 | .pln { color: #000 } /* plain text */ 2 | 3 | @media screen { 4 | .str { color: #080 } /* string content */ 5 | .kwd { color: #008 } /* a keyword */ 6 | .com { color: #800 } /* a comment */ 7 | .typ { color: #606 } /* a type name */ 8 | .lit { color: #066 } /* a literal value */ 9 | /* punctuation, lisp open bracket, lisp close bracket */ 10 | .pun, .opn, .clo { color: #660 } 11 | .tag { color: #008 } /* a markup tag name */ 12 | .atn { color: #606 } /* a markup attribute name */ 13 | .atv { color: #080 } /* a markup attribute value */ 14 | .dec, .var { color: #606 } /* a declaration; a variable name */ 15 | .fun { color: red } /* a function name */ 16 | } 17 | 18 | /* Use higher contrast and text-weight for printable form. */ 19 | @media print, projection { 20 | .str { color: #060 } 21 | .kwd { color: #006; font-weight: bold } 22 | .com { color: #600; font-style: italic } 23 | .typ { color: #404; font-weight: bold } 24 | .lit { color: #044 } 25 | .pun, .opn, .clo { color: #440 } 26 | .tag { color: #006; font-weight: bold } 27 | .atn { color: #404 } 28 | .atv { color: #060 } 29 | } 30 | 31 | pre.prettyprint { 32 | padding: 8px; 33 | background-color: #f7f7f9; 34 | border: 1px solid #e1e1e8; 35 | } 36 | pre.prettyprint.linenums { 37 | -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 38 | -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 39 | box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; 40 | } 41 | ol.linenums { 42 | margin: 0 0 0 33px; /* IE indents via margin-left */ 43 | } 44 | ol.linenums li { 45 | padding-left: 12px; 46 | font-size:12px; 47 | color: #bebec5; 48 | line-height: 18px; 49 | text-shadow: 0 1px 0 #fff; 50 | list-style-type:decimal!important; 51 | } 52 | -------------------------------------------------------------------------------- /test/ngScenario/matchersSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('angular.scenario.matchers', function () { 4 | var matchers; 5 | 6 | function expectMatcher(value, test) { 7 | delete matchers.error; 8 | delete matchers.future.value; 9 | if (value !== undefined) { 10 | matchers.future.value = value; 11 | } 12 | test(); 13 | expect(matchers.error).toBeUndefined(); 14 | } 15 | 16 | beforeEach(function() { 17 | /** 18 | * Mock up the future system wrapped around matchers. 19 | * 20 | * @see Scenario.js#angular.scenario.matcher 21 | */ 22 | matchers = { 23 | future: { name: 'test' } 24 | }; 25 | matchers.addFuture = function(name, callback) { 26 | callback(function(error) { 27 | matchers.error = error; 28 | }); 29 | }; 30 | angular.extend(matchers, angular.scenario.matcher); 31 | }); 32 | 33 | it('should handle basic matching', function() { 34 | expectMatcher(10, function() { matchers.toEqual(10); }); 35 | expectMatcher('value', function() { matchers.toBeDefined(); }); 36 | expectMatcher([1], function() { matchers.toBeTruthy(); }); 37 | expectMatcher("", function() { matchers.toBeFalsy(); }); 38 | expectMatcher(0, function() { matchers.toBeFalsy(); }); 39 | expectMatcher('foo', function() { matchers.toMatch('.o.'); }); 40 | expectMatcher(null, function() { matchers.toBeNull(); }); 41 | expectMatcher([1, 2, 3], function() { matchers.toContain(2); }); 42 | expectMatcher(3, function() { matchers.toBeLessThan(10); }); 43 | expectMatcher(3, function() { matchers.toBeGreaterThan(-5); }); 44 | }); 45 | 46 | it('should have toHaveClass matcher', function(){ 47 | var e = angular.element('
      '); 48 | expect(e).not.toHaveClass('none'); 49 | expect(e).toHaveClass('abc'); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /src/ngScenario/output/Xml.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Generates XML output into a context. 5 | */ 6 | angular.scenario.output('xml', function(context, runner, model) { 7 | var $ = function(args) {return new context.init(args);}; 8 | model.on('RunnerEnd', function() { 9 | var scenario = $(''); 10 | context.append(scenario); 11 | serializeXml(scenario, model.value); 12 | }); 13 | 14 | /** 15 | * Convert the tree into XML. 16 | * 17 | * @param {Object} context jQuery context to add the XML to. 18 | * @param {Object} tree node to serialize 19 | */ 20 | function serializeXml(context, tree) { 21 | angular.forEach(tree.children, function(child) { 22 | var describeContext = $(''); 23 | describeContext.attr('id', child.id); 24 | describeContext.attr('name', child.name); 25 | context.append(describeContext); 26 | serializeXml(describeContext, child); 27 | }); 28 | var its = $(''); 29 | context.append(its); 30 | angular.forEach(tree.specs, function(spec) { 31 | var it = $(''); 32 | it.attr('id', spec.id); 33 | it.attr('name', spec.name); 34 | it.attr('duration', spec.duration); 35 | it.attr('status', spec.status); 36 | its.append(it); 37 | angular.forEach(spec.steps, function(step) { 38 | var stepContext = $(''); 39 | stepContext.attr('name', step.name); 40 | stepContext.attr('duration', step.duration); 41 | stepContext.attr('status', step.status); 42 | it.append(stepContext); 43 | if (step.error) { 44 | var error = $(''); 45 | stepContext.append(error); 46 | error.text(formatException(step.error)); 47 | } 48 | }); 49 | }); 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /src/ng/directive/ngStyle.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc directive 5 | * @name ng.directive:ngStyle 6 | * @restrict AC 7 | * 8 | * @description 9 | * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally. 10 | * 11 | * @element ANY 12 | * @param {expression} ngStyle {@link guide/expression Expression} which evals to an 13 | * object whose keys are CSS style names and values are corresponding values for those CSS 14 | * keys. 15 | * 16 | * @example 17 | 18 | 19 | 20 | 21 |
      22 | Sample Text 23 |
      myStyle={{myStyle}}
      24 |
      25 | 26 | span { 27 | color: black; 28 | } 29 | 30 | 31 | it('should check ng-style', function() { 32 | expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); 33 | element('.doc-example-live :button[value=set]').click(); 34 | expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)'); 35 | element('.doc-example-live :button[value=clear]').click(); 36 | expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); 37 | }); 38 | 39 |
      40 | */ 41 | var ngStyleDirective = ngDirective(function(scope, element, attr) { 42 | scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) { 43 | if (oldStyles && (newStyles !== oldStyles)) { 44 | forEach(oldStyles, function(val, style) { element.css(style, '');}); 45 | } 46 | if (newStyles) element.css(newStyles); 47 | }, true); 48 | }); 49 | -------------------------------------------------------------------------------- /src/ngScenario/Future.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * A future action in a spec. 5 | * 6 | * @param {string} name name of the future action 7 | * @param {function()} behavior future callback(error, result) 8 | * @param {function()} line Optional. function that returns the file/line number. 9 | */ 10 | angular.scenario.Future = function(name, behavior, line) { 11 | this.name = name; 12 | this.behavior = behavior; 13 | this.fulfilled = false; 14 | this.value = undefined; 15 | this.parser = angular.identity; 16 | this.line = line || function() { return ''; }; 17 | }; 18 | 19 | /** 20 | * Executes the behavior of the closure. 21 | * 22 | * @param {function()} doneFn Callback function(error, result) 23 | */ 24 | angular.scenario.Future.prototype.execute = function(doneFn) { 25 | var self = this; 26 | this.behavior(function(error, result) { 27 | self.fulfilled = true; 28 | if (result) { 29 | try { 30 | result = self.parser(result); 31 | } catch(e) { 32 | error = e; 33 | } 34 | } 35 | self.value = error || result; 36 | doneFn(error, result); 37 | }); 38 | }; 39 | 40 | /** 41 | * Configures the future to convert it's final with a function fn(value) 42 | * 43 | * @param {function()} fn function(value) that returns the parsed value 44 | */ 45 | angular.scenario.Future.prototype.parsedWith = function(fn) { 46 | this.parser = fn; 47 | return this; 48 | }; 49 | 50 | /** 51 | * Configures the future to parse it's final value from JSON 52 | * into objects. 53 | */ 54 | angular.scenario.Future.prototype.fromJson = function() { 55 | return this.parsedWith(angular.fromJson); 56 | }; 57 | 58 | /** 59 | * Configures the future to convert it's final value from objects 60 | * into JSON. 61 | */ 62 | angular.scenario.Future.prototype.toJson = function() { 63 | return this.parsedWith(angular.toJson); 64 | }; 65 | -------------------------------------------------------------------------------- /docs/content/guide/dev_guide.services.testing_services.ngdoc: -------------------------------------------------------------------------------- 1 | @ngdoc overview 2 | @name Developer Guide: Angular Services: Testing Angular Services 3 | @description 4 | 5 | The following is a unit test for the 'notify' service in the 'Dependencies' example in {@link 6 | dev_guide.services.creating_services Creating Angular Services}. The unit test example uses Jasmine 7 | spy (mock) instead of a real browser alert. 8 | 9 |
      10 | var mock, notify;
      11 | 
      12 | beforeEach(function() {
      13 |   mock = {alert: jasmine.createSpy()};
      14 | 
      15 |   module(function($provide) {
      16 |     $provide.value('$window', mock);
      17 |   });
      18 | 
      19 |   inject(function($injector) {
      20 |     notify = $injector.get('notify');
      21 |   });
      22 | });
      23 | 
      24 | it('should not alert first two notifications', function() {
      25 |   notify('one');
      26 |   notify('two');
      27 | 
      28 |   expect(mock.alert).not.toHaveBeenCalled();
      29 | });
      30 | 
      31 | it('should alert all after third notification', function() {
      32 |   notify('one');
      33 |   notify('two');
      34 |   notify('three');
      35 | 
      36 |   expect(mock.alert).toHaveBeenCalledWith("one\ntwo\nthree");
      37 | });
      38 | 
      39 | it('should clear messages after alert', function() {
      40 |   notify('one');
      41 |   notify('two');
      42 |   notify('third');
      43 |   notify('more');
      44 |   notify('two');
      45 |   notify('third');
      46 | 
      47 |   expect(mock.alert.callCount).toEqual(2);
      48 |   expect(mock.alert.mostRecentCall.args).toEqual(["more\ntwo\nthird"]);
      49 | });
      50 | 
      51 | 52 | 53 | ## Related Topics 54 | 55 | * {@link dev_guide.services.understanding_services Understanding Angular Services} 56 | * {@link dev_guide.services.creating_services Creating Angular Services} 57 | * {@link dev_guide.services.managing_dependencies Managing Service Dependencies} 58 | * {@link dev_guide.services.injecting_controllers Injecting Services Into Controllers} 59 | 60 | ## Related API 61 | 62 | * {@link api/ng Angular Service API} 63 | -------------------------------------------------------------------------------- /changelog.spec.js: -------------------------------------------------------------------------------- 1 | describe('changelog.js', function() { 2 | var ch = require('./changelog'); 3 | 4 | describe('parseRawCommit', function() { 5 | it('should parse raw commit', function() { 6 | var msg = ch.parseRawCommit( 7 | '9b1aff905b638aa274a5fc8f88662df446d374bd\n' + 8 | 'feat(scope): broadcast $destroy event on scope destruction\n' + 9 | 'perf testing shows that in chrome this change adds 5-15% overhead\n' + 10 | 'when destroying 10k nested scopes where each scope has a $destroy listener\n'); 11 | 12 | expect(msg.type).toBe('feat'); 13 | expect(msg.hash).toBe('9b1aff905b638aa274a5fc8f88662df446d374bd'); 14 | expect(msg.subject).toBe('broadcast $destroy event on scope destruction'); 15 | expect(msg.body).toBe('perf testing shows that in chrome this change adds 5-15% overhead\n' + 16 | 'when destroying 10k nested scopes where each scope has a $destroy listener\n') 17 | expect(msg.component).toBe('scope'); 18 | }); 19 | 20 | 21 | it('should parse closed issues', function() { 22 | var msg = ch.parseRawCommit( 23 | '13f31602f396bc269076ab4d389cfd8ca94b20ba\n' + 24 | 'feat(ng-list): Allow custom separator\n' + 25 | 'bla bla bla\n\n' + 26 | 'Closes #123\nCloses #25\n'); 27 | 28 | expect(msg.closes).toEqual([123, 25]); 29 | }); 30 | 31 | 32 | it('should parse breaking changes', function() { 33 | var msg = ch.parseRawCommit( 34 | '13f31602f396bc269076ab4d389cfd8ca94b20ba\n' + 35 | 'feat(ng-list): Allow custom separator\n' + 36 | 'bla bla bla\n\n' + 37 | 'BREAKING CHANGE: first breaking change\nsomething else\n' + 38 | 'another line with more info\n'); 39 | 40 | expect(msg.breaking).toEqual(' first breaking change\nsomething else\nanother line with more info\n'); 41 | }); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /src/ng/directive/ngCsp.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc directive 5 | * @name ng.directive:ngCsp 6 | * 7 | * @element html 8 | * @description 9 | * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support. 10 | * 11 | * This is necessary when developing things like Google Chrome Extensions. 12 | * 13 | * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things). 14 | * For us to be compatible, we just need to implement the "getterFn" in $parse without violating 15 | * any of these restrictions. 16 | * 17 | * AngularJS uses `Function(string)` generated functions as a speed optimization. Applying the `ngCsp` 18 | * directive will cause Angular to use CSP compatibility mode. When this mode is on AngularJS will 19 | * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will 20 | * be raised. 21 | * 22 | * CSP forbids JavaScript to inline stylesheet rules. In non CSP mode Angular automatically 23 | * includes some CSS rules (e.g. {@link ng.directive:ngCloak ngCloak}). 24 | * To make those directives work in CSP mode, include the `angular-csp.css` manually. 25 | * 26 | * In order to use this feature put the `ngCsp` directive on the root element of the application. 27 | * 28 | * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.* 29 | * 30 | * @example 31 | * This example shows how to apply the `ngCsp` directive to the `html` tag. 32 |
      33 |      
      34 |      
      35 |      ...
      36 |      ...
      37 |      
      38 |    
      39 | */ 40 | 41 | // ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap 42 | // the system (before $parse is instantiated), for this reason we just have a csp() fn that looks for ng-csp attribute 43 | // anywhere in the current doc 44 | -------------------------------------------------------------------------------- /test/ng/urlUtilsSpec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('urlUtils', function() { 4 | describe('urlResolve', function() { 5 | it('should normalize a relative url', function () { 6 | expect(urlResolve("foo").href).toMatch(/^https?:\/\/[^/]+\/foo$/); 7 | }); 8 | 9 | it('should parse relative URL into component pieces', function () { 10 | var parsed = urlResolve("foo"); 11 | expect(parsed.href).toMatch(/https?:\/\//); 12 | expect(parsed.protocol).toMatch(/^https?/); 13 | expect(parsed.host).not.toBe(""); 14 | expect(parsed.hostname).not.toBe(""); 15 | expect(parsed.pathname).not.toBe(""); 16 | }); 17 | 18 | 19 | it('should return pathname as / if empty path provided', function () { 20 | //IE counts / as empty, necessary to use / so that pathname is not context.html 21 | var parsed = urlResolve('/'); 22 | expect(parsed.pathname).toBe('/'); 23 | }) 24 | }); 25 | 26 | describe('isSameOrigin', function() { 27 | it('should support various combinations of urls - both string and parsed', inject(function($document) { 28 | function expectIsSameOrigin(url, expectedValue) { 29 | expect(urlIsSameOrigin(url)).toBe(expectedValue); 30 | expect(urlIsSameOrigin(urlResolve(url, true))).toBe(expectedValue); 31 | } 32 | expectIsSameOrigin('path', true); 33 | var origin = urlResolve($document[0].location.href, true); 34 | expectIsSameOrigin('//' + origin.host + '/path', true); 35 | // Different domain. 36 | expectIsSameOrigin('http://example.com/path', false); 37 | // Auto fill protocol. 38 | expectIsSameOrigin('//example.com/path', false); 39 | // Should not match when the ports are different. 40 | // This assumes that the test is *not* running on port 22 (very unlikely). 41 | expectIsSameOrigin('//' + origin.hostname + ':22/path', false); 42 | })); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /src/ng/directive/ngInit.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc directive 5 | * @name ng.directive:ngInit 6 | * @restrict AC 7 | * 8 | * @description 9 | * The `ngInit` directive allows you to evaluate an expression in the 10 | * current scope. 11 | * 12 | *
      13 | * The only appropriate use of `ngInit` is for aliasing special properties of 14 | * {@link api/ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below. Besides this case, you 15 | * should use {@link guide/controller controllers} rather than `ngInit` 16 | * to initialize values on a scope. 17 | *
      18 | * 19 | * @priority 450 20 | * 21 | * @element ANY 22 | * @param {expression} ngInit {@link guide/expression Expression} to eval. 23 | * 24 | * @example 25 | 26 | 27 | 32 |
      33 |
      34 |
      35 | list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}}; 36 |
      37 |
      38 |
      39 |
      40 | 41 | it('should alias index positions', function() { 42 | expect(element('.example-init').text()) 43 | .toBe('list[ 0 ][ 0 ] = a;' + 44 | 'list[ 0 ][ 1 ] = b;' + 45 | 'list[ 1 ][ 0 ] = c;' + 46 | 'list[ 1 ][ 1 ] = d;'); 47 | }); 48 | 49 |
      50 | */ 51 | var ngInitDirective = ngDirective({ 52 | priority: 450, 53 | compile: function() { 54 | return { 55 | pre: function(scope, element, attrs) { 56 | scope.$eval(attrs.ngInit); 57 | } 58 | }; 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /i18n/src/parser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple parser to parse a number format into a pattern object 3 | */ 4 | 5 | exports.parsePattern = parsePattern; 6 | 7 | var PATTERN_SEP = ';', 8 | DECIMAL_SEP = '.', 9 | GROUP_SEP = ',', 10 | ZERO = '0', 11 | DIGIT = '#'; 12 | 13 | /** 14 | * main funciton for parser 15 | * @param str {string} pattern to be parsed (e.g. #,##0.###). 16 | */ 17 | function parsePattern(pattern) { 18 | var p = { 19 | minInt: 1, 20 | minFrac: 0, 21 | macFrac: 0, 22 | posPre: '', 23 | posSuf: '', 24 | negPre: '', 25 | negSuf: '', 26 | gSize: 0, 27 | lgSize: 0 28 | }; 29 | 30 | var parts = pattern.split(PATTERN_SEP), 31 | positive = parts[0], 32 | negative = parts[1]; 33 | 34 | var parts = positive.split(DECIMAL_SEP), 35 | integer = parts[0], 36 | fraction = parts[1]; 37 | 38 | p.posPre = integer.substr(0, integer.indexOf(DIGIT)); 39 | 40 | for (var i = 0; i < fraction.length; i++) { 41 | var ch = fraction.charAt(i); 42 | if (ch == ZERO) p.minFrac = p.maxFrac = i + 1; 43 | else if (ch == DIGIT) p.maxFrac = i + 1; 44 | else p.posSuf += ch; 45 | } 46 | 47 | var groups = integer.split(GROUP_SEP); 48 | p.gSize = groups[1] ? groups[1].length : 0; 49 | p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0; 50 | 51 | if (negative) { 52 | var trunkLen = positive.length - p.posPre.length - p.posSuf.length, 53 | pos = negative.indexOf(DIGIT); 54 | 55 | p.negPre = negative.substr(0, pos).replace(/\'/g, ''); 56 | p.negSuf = negative.substr(pos + trunkLen).replace(/\'/g, ''); 57 | } else { 58 | // hardcoded '-' sign is fine as all locale use '-' as MINUS_SIGN. (\u2212 is the same as '-') 59 | p.negPre = p.posPre + '-'; 60 | p.negSuf = p.posSuf; 61 | } 62 | 63 | return p; 64 | } 65 | --------------------------------------------------------------------------------