MCPcopy
hub / github.com/angular-ui/ui-router / $CoreAnimateCssProvider

Function $CoreAnimateCssProvider

test/angular/1.7/angular.js:6446–6504  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6444 * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
6445 */
6446var $CoreAnimateCssProvider = function() {
6447 this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
6448
6449 return function(element, initialOptions) {
6450 // all of the animation functions should create
6451 // a copy of the options data, however, if a
6452 // parent service has already created a copy then
6453 // we should stick to using that
6454 var options = initialOptions || {};
6455 if (!options.$$prepared) {
6456 options = copy(options);
6457 }
6458
6459 // there is no point in applying the styles since
6460 // there is no animation that goes on at all in
6461 // this version of $animateCss.
6462 if (options.cleanupStyles) {
6463 options.from = options.to = null;
6464 }
6465
6466 if (options.from) {
6467 element.css(options.from);
6468 options.from = null;
6469 }
6470
6471 var closed, runner = new $$AnimateRunner();
6472 return {
6473 start: run,
6474 end: run
6475 };
6476
6477 function run() {
6478 $$rAF(function() {
6479 applyAnimationContents();
6480 if (!closed) {
6481 runner.complete();
6482 }
6483 closed = true;
6484 });
6485 return runner;
6486 }
6487
6488 function applyAnimationContents() {
6489 if (options.addClass) {
6490 element.addClass(options.addClass);
6491 options.addClass = null;
6492 }
6493 if (options.removeClass) {
6494 element.removeClass(options.removeClass);
6495 options.removeClass = null;
6496 }
6497 if (options.to) {
6498 element.css(options.to);
6499 options.to = null;
6500 }
6501 }
6502 };
6503 }];

Callers

nothing calls this directly

Calls 1

copyFunction · 0.70

Tested by

no test coverage detected