aboutsummaryrefslogtreecommitdiffstats
path: root/src/AngularPublic.js
AgeCommit message (Collapse)Author
2014-02-16docs(bike-shed-migration): convert doctype and namesPeter Bacon Darwin
2014-02-16docs(bike-shed-migration): Add missing module tagPeter Bacon Darwin
The generator is able to imply the module from the containing folder for most files but these are in the ng module but are stored at the root folder.
2013-12-12fix(ngInclude): Add template to DOM before linking other directivesTobias Bosch
The template needs to be added to the DOM before other directives at the same element as `ngInclude` are linked. Fixes #5247.
2013-11-26fix($sanitize): Use same whitelist mechanism as $compile does.Tobias Bosch
`$sanitize` now uses the same mechanism as `$compile` to validate uris. By this, the validation in `$sanitize` is more general and can be configured in the same way as the one in `$compile`. Changes - Creates the new private service `$$sanitizeUri`. - Moves related specs from `compileSpec.js` into `sanitizeUriSpec.js`. - Refactors the `linky` filter to be less dependent on `$sanitize` internal functions. Fixes #3748.
2013-10-22style: make jshint happyVojta Jina
2013-10-18fix(csp): fix csp auto-detection and stylesheet injectionIgor Minar
When we refactored , we broke the csp mode because the previous implementation relied on the fact that it was ok to lazy initialize the .csp property, this is not the case any more. Besides, we need to know about csp mode during bootstrap and avoid injecting the stylesheet when csp is active, so I refactored the code to fix both issues. PR #4411 will follow up on this commit and add more improvements. Closes #917 Closes #2963 Closes #4394 Closes #4444 BREAKING CHANGE: triggering ngCsp directive via `ng:csp` attribute is not supported any more. Please use data-ng-csp instead.
2013-10-10refactor(location): $location now uses urlUtils, not RegExJeff Cross
The location service, and other portions of the application, were relying on a complicated regular expression to get parts of a URL. But there is already a private urlUtils provider, which relies on HTMLAnchorElement to provide this information, and is suitable for most cases. In order to make urlUtils more accessible in the absence of DI, its methods were converted to standalone functions available globally. The urlUtils.resolve method was renamed urlResolve, and was refactored to only take 1 argument, url, and not the 2nd "parse" boolean. The method now always returns a parsed url. All places in code which previously wanted a string instead of a parsed url can now get the value from the href property of the returned object. Tests were also added to ensure IPv6 addresses were handled correctly. Closes #3533 Closes #2950 Closes #3249
2013-10-07feat($interval): add a service wrapping setIntervalJulie
The $interval service simplifies creating and testing recurring tasks. This service does not increment $browser's outstanding request count, which means that scenario tests and Protractor tests will not timeout when a site uses a polling function registered by $interval. Provides a workaround for #2402. For unit tests, repeated tasks can be controlled using ngMock$interval's tick(), tickNext(), and tickAll() functions.
2013-07-26feat(ngAnimate): complete rewrite of animationsMatias Niemelä
- ngAnimate directive is gone and was replaced with class based animations/transitions - support for triggering animations on css class additions and removals - done callback was added to all animation apis - $animation and $animator where merged into a single $animate service with api: - $animate.enter(element, parent, after, done); - $animate.leave(element, done); - $animate.move(element, parent, after, done); - $animate.addClass(element, className, done); - $animate.removeClass(element, className, done); BREAKING CHANGE: too many things changed, we'll write up a separate doc with migration instructions
2013-07-25feat(ngBindHtml, sce): combine ng-bind-html and ng-bind-html-unsafeChirayu Krishnappa
Changes: - remove ng-bind-html-unsafe - ng-bind-html is now in core - ng-bind-html is secure - supports SCE - so you can bind to an arbitrary trusted string - automatic sanitization if $sanitize is available BREAKING CHANGE: ng-html-bind-unsafe has been removed and replaced by ng-html-bind (which has been removed from ngSanitize.) ng-bind-html provides ng-html-bind-unsafe like behavior (innerHTML's the result without sanitization) when bound to the result of $sce.trustAsHtml(string). When bound to a plain string, the string is sanitized via $sanitize before being innerHTML'd. If $sanitize isn't available, it's logs an exception.
2013-07-25feat($sce): new $sce service for Strict Contextual Escaping.Chirayu Krishnappa
$sce is a service that provides Strict Contextual Escaping services to AngularJS. Strict Contextual Escaping -------------------------- Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain contexts to result in a value that is marked as safe to use for that context One example of such a context is binding arbitrary html controlled by the user via ng-bind-html-unsafe. We refer to these contexts as privileged or SCE contexts. As of version 1.2, Angular ships with SCE enabled by default. Note: When enabled (the default), IE8 in quirks mode is not supported. In this mode, IE8 allows one to execute arbitrary javascript by the use of the expression() syntax. Refer http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx to learn more about them. You can ensure your document is in standards mode and not quirks mode by adding <!doctype html> to the top of your HTML document. SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for security vulnerabilities such as XSS, clickjacking, etc. a lot easier. Here's an example of a binding in a privileged context: <input ng-model="userHtml"> <div ng-bind-html-unsafe="{{userHtml}}"> Notice that ng-bind-html-unsafe is bound to {{userHtml}} controlled by the user. With SCE disabled, this application allows the user to render arbitrary HTML into the DIV. In a more realistic example, one may be rendering user comments, blog articles, etc. via bindings. (HTML is just one example of a context where rendering user controlled input creates security vulnerabilities.) For the case of HTML, you might use a library, either on the client side, or on the server side, to sanitize unsafe HTML before binding to the value and rendering it in the document. How would you ensure that every place that used these types of bindings was bound to a value that was sanitized by your library (or returned as safe for rendering by your server?) How can you ensure that you didn't accidentally delete the line that sanitized the value, or renamed some properties/fields and forgot to update the binding to the sanitized value? To be secure by default, you want to ensure that any such bindings are disallowed unless you can determine that something explicitly says it's safe to use a value for binding in that context. You can then audit your code (a simple grep would do) to ensure that this is only done for those values that you can easily tell are safe - because they were received from your server, sanitized by your library, etc. You can organize your codebase to help with this - perhaps allowing only the files in a specific directory to do this. Ensuring that the internal API exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task. In the case of AngularJS' SCE service, one uses $sce.trustAs (and shorthand methods such as $sce.trustAsHtml, etc.) to obtain values that will be accepted by SCE / privileged contexts. In privileged contexts, directives and code will bind to the result of $sce.getTrusted(context, value) rather than to the value directly. Directives use $sce.parseAs rather than $parse to watch attribute bindings, which performs the $sce.getTrusted behind the scenes on non-constant literals. As an example, ngBindHtmlUnsafe uses $sce.parseAsHtml(binding expression). Here's the actual code (slightly simplified): var ngBindHtmlUnsafeDirective = ['$sce', function($sce) { return function(scope, element, attr) { scope.$watch($sce.parseAsHtml(attr.ngBindHtmlUnsafe), function(value) { element.html(value || ''); }); }; }]; Impact on loading templates --------------------------- This applies both to the ng-include directive as well as templateUrl's specified by directives. By default, Angular only loads templates from the same domain and protocol as the application document. This is done by calling $sce.getTrustedResourceUrl on the template URL. To load templates from other domains and/or protocols, you may either either whitelist them or wrap it into a trusted value. *Please note*: The browser's Same Origin Policy and Cross-Origin Resource Sharing (CORS) policy apply in addition to this and may further restrict whether the template is successfully loaded. This means that without the right CORS policy, loading templates from a different domain won't work on all browsers. Also, loading templates from file:// URL does not work on some browsers. This feels like too much overhead for the developer? ---------------------------------------------------- It's important to remember that SCE only applies to interpolation expressions. If your expressions are constant literals, they're automatically trusted and you don't need to call $sce.trustAs on them. e.g. <div ng-html-bind-unsafe="'<b>implicitly trusted</b>'"></div> just works. Additionally, a[href] and img[src] automatically sanitize their URLs and do not pass them through $sce.getTrusted. SCE doesn't play a role here. The included $sceDelegate comes with sane defaults to allow you to load templates in ng-include from your application's domain without having to even know about SCE. It blocks loading templates from other domains or loading templates over http from an https served document. You can change these by setting your own custom whitelists and blacklists for matching such URLs. This significantly reduces the overhead. It is far easier to pay the small overhead and have an application that's secure and can be audited to verify that with much more ease than bolting security onto an application later.
2013-07-19fix(core): parse URLs using the browser's DOM APIChirayu Krishnappa
2013-07-18feat(Angular): provide minErr as public propertyPete Bacon Darwin
This allows us to use minErr in other modules, such as resource and sanitize.
2013-07-11fix(ngSubmit): expose $event to ngSubmit callbackWesley Cho
2013-06-06chore(AngularPublic): remove angular.noConflict featureMatias Niemelä
2013-06-06refactor($route): pull $route and friends into angular-route.jsIgor Minar
$route, $routeParams and ngView have been pulled from core angular.js to angular-route.js/ngRoute module. This is was done to in order keep the core focused on most commonly used functionality and allow community routers to be freely used instead of $route service. There is no need to panic, angular-route will keep on being supported by the angular team. Note: I'm intentionally not fixing tutorial links. Tutorial will need bigger changes and those should be done when we update tutorial to 1.2. BREAKING CHANGE: applications that use $route will now need to load angular-route.js file and define dependency on ngRoute module. Before: ``` ... <script src="angular.js"></script> ... var myApp = angular.module('myApp', ['someOtherModule']); ... ``` After: ``` ... <script src="angular.js"></script> <script src="angular-route.js"></script> ... var myApp = angular.module('myApp', ['ngRoute', 'someOtherModule']); ... ``` Closes #2804
2013-04-19feat(ngIf): add directive to remove and recreate DOM elementsOren Avissar
This directive is adapted from ui-if in the AngularUI project and provides a complement to the ngShow/ngHide directives that only change the visibility of the DOM element and ngSwitch which does change the DOM but is more verbose.
2013-04-02feat(ngAnimate): add support for animationMisko Hevery
2013-03-05chore(Grunt): switch from Rake to GruntDave Geddes
Migrates the Angular project from Rake to Grunt. Benefits: - Drops Ruby dependency - Lowers barrier to entry for contributions from JavaScript ninjas - Simplifies the Angular project setup and build process - Adopts industry-standard tools specific to JavaScript projects - Support building angular.js on Windows platform (really?!? why?!?) BREAKING CHANGE: Rake is completely replaced by Grunt. Below are the deprecated Rake tasks and their Grunt equivalents: rake --> grunt rake package --> grunt package rake init --> N/A rake clean --> grunt clean rake concat_scenario --> grunt build:scenario rake concat --> grunt build rake concat_scenario --> grunt build:scenario rake minify --> grunt minify rake version --> grunt write:version rake docs --> grunt docs rake webserver --> grunt webserver rake test --> grunt test rake test:unit --> grunt test:unit rake test:<jqlite|jquery|modules|e2e> --> grunt test:<jqlite|jquery|modules|end2end|e2e> rake test[Firefox+Safari] --> grunt test --browsers Firefox,Safari rake test[Safari] --> grunt test --browsers Safari rake autotest --> grunt autotest NOTES: * For convenience grunt test:e2e starts a webserver for you, while grunt test:end2end doesn't. Use grunt test:end2end if you already have the webserver running. * Removes duplicate entry for Describe.js in the angularScenario section of angularFiles.js * Updates docs/src/gen-docs.js to use #done intead of the deprecated #end * Uses grunt-contrib-connect instead of lib/nodeserver (removed) * Removes nodeserver.sh, travis now uses grunt webserver * Built and minified files are identical to Rake's output, with the exception of one less character for git revisions (using --short) and a couple minor whitespace differences Closes #199
2013-02-14feat(noConflict): restore previous angular namespace referenceJames Morrin
2012-06-12fix($defer): remove deprecated $defer serviceIgor Minar
2012-05-23feat($timeout): add $timeout service that supersedes $deferIgor Minar
$timeout has a better name ($defer got often confused with something related to $q) and is actually promise based with cancelation support. With this commit the $defer service is deprecated and will be removed before 1.0. Closes #704, #532
2012-04-27feat($parse): CSP compatibilityIgor Minar
CSP (content security policy) forbids apps to use eval or Function(string) generated functions (among other things). For us to be compatible, we just need to implement the "getterFn" in $parse without violating any of these restrictions. We currently use Function(string) generated functions as a speed optimization. With this change, it will be possible to opt into the CSP compatible mode using the ngCsp directive. When this mode is on Angular will evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will be raised. In order to use this feature put ngCsp directive on the root element of the application. For example: <!doctype html> <html ng-app ng-csp> ... ... </html> Closes #893
2012-04-11chore(ngSanitize): extract $sanitize, ngBindHtml, linkyFilter into a moduleVojta Jina
Create build for other modules as well (ngResource, ngCookies): - wrap into a function - add license - add version Breaks `$sanitize` service, `ngBindHtml` directive and `linky` filter were moved to the `ngSanitize` module. Apps that depend on any of these will need to load `angular-sanitize.js` and include `ngSanitize` in their dependency list: `var myApp = angular.module('myApp', ['ngSanitize']);`
2012-04-10chore(*): remove dead code and fix code style issuesIgor Minar
2012-04-03feat(ngModel): update model on each key stroke (revert ngModelInstant)Vojta Jina
It turns out that listening only on "blur" event is not sufficient in many scenarios, especially when you use form validation you always had to use ngModelnstant e.g. if you want to disable a button based on valid/invalid form. The feedback we got from our apps as well as external apps is that the ngModelInstant should be the default. In the future we might provide alternative ways of suppressing updates on each key stroke, but it's not going to be the default behavior. Apps already using the ngModelInstant can safely remove it from their templates. Input fields without ngModelInstant directive will start propagating the input changes into the model on each key stroke.
2012-03-28chore(ngCookies): moved to moduleMisko Hevery
2012-03-28chore(Rakefile): get ready for modulesMisko Hevery
2012-03-26refactor(ngBindAttr): removeVojta Jina
Breaks ng-bind-attr directive removed
2012-03-26feat(ngValue): allow radio inputs to have non string valuesVojta Jina
Closes #816
2012-03-13feat(compile): allow ngForm on attribute and classMisko Hevery
#feature - ngForm directive can now be used with element, class, and attributes
2012-03-09refactor($provide) Rename service -> providerVojta Jina
It registers a provider class, so this makes more sense. Breaks Rename $provide.service -> $provide.provider
2012-03-08fix(ng-view, ng-include): onload and $contentLoadedIgor Minar
- change custom onload directive to special arguments recongnized by both ng-view and ng-include - rename $contentLoaded event to $viewContentLoaded and $includeContentLoaded - add event docs
2012-03-08chore(compiler): change default restriction to attribute only for directivesMisko Hevery
2012-02-28reafactor: Rename ng:bind-immediate -> ng:model-instantVojta Jina
2012-02-28feat(ng:include) Fire $contentLoaded eventVojta Jina
+ refactor unload to listen on this event -> we can use unload with ng:view as well Closes #743
2012-02-28refactor(forms): Even better formsVojta Jina
- remove $formFactory completely - remove parallel scope hierarchy (forms, widgets) - use new compiler features (widgets, forms are controllers) - any directive can add formatter/parser (validators, convertors) Breaks no custom input types Breaks removed integer input type Breaks remove list input type (ng-list directive instead) Breaks inputs bind only blur event by default (added ng:bind-change directive)
2012-02-28feat(directive.style): Do not compile content of style elementVojta Jina
2012-02-21chore(ng:switch): rewritten with transclusion APIMisko Hevery
BREAKING CHANGE: the change event fires on scope of switch not on scope of case.
2012-02-21feat($compile) add locals, isolate scope, transclusionMisko Hevery
2012-01-25feat(scriptTemplateLoader): provide template inliningMisko Hevery
populates $templateCache with content of ng-template scripts
2012-01-25refactor(directives): connect new compilerMisko Hevery
- turn everything into a directive
2012-01-23refactor($controller): Add $controller service for instantiating controllersVojta Jina
So that we can allow user to override this service and use BC hack: https://gist.github.com/1649788
2012-01-13refactor($autoScroll): rename to $anchorScroll and allow disabling auto ↵Vojta Jina
scrolling (links) Now, that we have autoscroll attribute on ng:include, there is no reason to disable the service completely, so $anchorScrollProvider.disableAutoScrolling() means it won't be scrolling when $location.hash() changes. And then, it's not $autoScroll at all, it actually scrolls to anchor when it's called, so I renamed it to $anchorScroll.
2012-01-12refactor(module): strict separation between module-config / app-runtimeMisko Hevery
2012-01-10feat(module): new module loaderMisko Hevery
2011-12-07fix(): use angular.callbacks namespace for jsonp callbacksIgor Minar
Previously we used to put callbacks on the window object, but that causes problems on IE8 where it is not possible to delete properties from the window object
2011-11-30feat($interpolate): string interpolation functionMisko Hevery
2011-11-30feat(deferreds/promises): Q-like deferred/promise implementation with a ton ↵Igor Minar
of specs
2011-11-30feat($templateCache): add $templateCache - shared by ng:include, ng:viewVojta Jina