├── .gitignore ├── README.md ├── gulpfile.config.js ├── gulpfile.js ├── package.json ├── src ├── app │ ├── app.module.ts │ ├── controllers │ │ ├── customers.controller.ts │ │ └── orders.controller.ts │ ├── directives │ │ └── filterTextbox.directive.ts │ ├── services │ │ └── data.service.ts │ └── views │ │ ├── customers.html │ │ └── orders.html ├── customers.json ├── index.html ├── orders.json └── styles │ └── animations.css ├── superstatic.json ├── tsconfig.json ├── tslint.json ├── typings.json └── typings ├── browser.d.ts ├── browser └── ambient │ ├── angular-animate │ └── index.d.ts │ ├── angular-route │ └── index.d.ts │ ├── angular │ └── index.d.ts │ └── jquery │ └── index.d.ts ├── main.d.ts └── main └── ambient ├── angular-animate └── index.d.ts ├── angular-route └── index.d.ts ├── angular └── index.d.ts └── jquery └── index.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | .DS_Store 3 | npm-debug.log 4 | /typings/ 5 | **/bower_packages 6 | 7 | # all generated JS 8 | src/js 9 | src/app/**/*.js 10 | src/app/**/*.js.map 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AngularIn20TypeScript 2 | 3 | Simple AngularJS Application with TypeScript, you can view video about typescript and angular in 20 minutes at ngconf 2015 on [youtube](https://www.youtube.com/watch?list=PLOETEcp3DkCoNnlhE-7fovYvqwVPrRiY7&feature=player_embedded&v=U7NYTKgkZgo) 4 | 5 | # Usage 6 | 7 | - Install global dependencies **if necessary** 8 | 9 | ``` 10 | npm install -g gulp-cli typings superstatic 11 | ``` 12 | 13 | - Install node packages: 14 | 15 | ``` 16 | npm install 17 | ``` 18 | 19 | - Launch the server 20 | 21 | ``` 22 | npm start 23 | ``` 24 | -------------------------------------------------------------------------------- /gulpfile.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var GulpConfig = (function () { 3 | function gulpConfig() { 4 | //Got tired of scrolling through all the comments so removed them 5 | //Don't hurt me AC :-) 6 | this.source = './src/'; 7 | this.sourceApp = this.source + 'app/'; 8 | 9 | this.tsOutputPath = this.source + '/js'; 10 | this.allJavaScript = [this.source + '/js/**/*.js']; 11 | this.allTypeScript = this.sourceApp + '/**/*.ts'; 12 | 13 | this.typings = './typings/'; 14 | this.libraryTypeScriptDefinitions = './typings/main/**/*.ts'; 15 | } 16 | return gulpConfig; 17 | })(); 18 | module.exports = GulpConfig; 19 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'), 4 | debug = require('gulp-debug'), 5 | inject = require('gulp-inject'), 6 | tsc = require('gulp-typescript'), 7 | tslint = require('gulp-tslint'), 8 | sourcemaps = require('gulp-sourcemaps'), 9 | del = require('del'), 10 | Config = require('./gulpfile.config'), 11 | tsProject = tsc.createProject('tsconfig.json'), 12 | browserSync = require('browser-sync'), 13 | superstatic = require( 'superstatic' ); 14 | 15 | var config = new Config(); 16 | 17 | /** 18 | * Generates the app.d.ts references file dynamically from all application *.ts files. 19 | */ 20 | // gulp.task('gen-ts-refs', function () { 21 | // var target = gulp.src(config.appTypeScriptReferences); 22 | // var sources = gulp.src([config.allTypeScript], {read: false}); 23 | // return target.pipe(inject(sources, { 24 | // starttag: '//{', 25 | // endtag: '//}', 26 | // transform: function (filepath) { 27 | // return '/// '; 28 | // } 29 | // })).pipe(gulp.dest(config.typings)); 30 | // }); 31 | 32 | /** 33 | * Lint all custom TypeScript files. 34 | */ 35 | gulp.task('ts-lint', function () { 36 | return gulp.src(config.allTypeScript).pipe(tslint()).pipe(tslint.report('prose')); 37 | }); 38 | 39 | /** 40 | * Compile TypeScript and include references to library and app .d.ts files. 41 | */ 42 | gulp.task('compile-ts', function () { 43 | var sourceTsFiles = [config.allTypeScript, //path to typescript files 44 | config.libraryTypeScriptDefinitions]; //reference to library .d.ts files 45 | 46 | 47 | var tsResult = gulp.src(sourceTsFiles) 48 | .pipe(sourcemaps.init()) 49 | .pipe(tsc(tsProject)); 50 | 51 | tsResult.dts.pipe(gulp.dest(config.tsOutputPath)); 52 | return tsResult.js 53 | .pipe(sourcemaps.write('.')) 54 | .pipe(gulp.dest(config.tsOutputPath)); 55 | }); 56 | 57 | /** 58 | * Remove all generated JavaScript files from TypeScript compilation. 59 | */ 60 | gulp.task('clean-ts', function (cb) { 61 | var typeScriptGenFiles = [ 62 | config.tsOutputPath +'/**/*.js', // path to all JS files auto gen'd by editor 63 | config.tsOutputPath +'/**/*.js.map', // path to all sourcemap files auto gen'd by editor 64 | '!' + config.tsOutputPath + '/lib' 65 | ]; 66 | 67 | // delete the files 68 | del(typeScriptGenFiles, cb); 69 | }); 70 | 71 | gulp.task('watch', function() { 72 | gulp.watch([config.allTypeScript], ['ts-lint', 'compile-ts']); 73 | }); 74 | 75 | gulp.task('serve', ['compile-ts', 'watch'], function() { 76 | process.stdout.write('Starting browserSync and superstatic...\n'); 77 | browserSync({ 78 | port: 3000, 79 | files: ['index.html', '**/*.js'], 80 | injectChanges: true, 81 | logFileChanges: false, 82 | logLevel: 'silent', 83 | logPrefix: 'angularin20typescript', 84 | notify: true, 85 | reloadDelay: 0, 86 | server: { 87 | baseDir: './src', 88 | middleware: superstatic({ debug: false}) 89 | } 90 | }); 91 | }); 92 | 93 | gulp.task('default', ['ts-lint', 'compile-ts']); 94 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angularjs-typescript-in20", 3 | "version": "1.0.0", 4 | "description": "AngularJS and TypeScript", 5 | "contributors": [ 6 | { 7 | "name": "Dan Wahlin" 8 | } 9 | ], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/DanWahlin/AngularIn20TypeScript" 13 | }, 14 | "scripts": { 15 | "postinstall": "npm run typings install && gulp", 16 | "start": "gulp serve", 17 | "typings": "typings" 18 | }, 19 | "keywords": [ 20 | "angularjs", 21 | "typescript" 22 | ], 23 | "license": "ISC", 24 | "dependencies": { 25 | 26 | }, 27 | "devDependencies": { 28 | "browser-sync": "^2.12.5", 29 | "del": "^2.2.0", 30 | "gulp": "^3.9.1", 31 | "gulp-debug": "^2.1.2", 32 | "gulp-inject": "^4.0.0", 33 | "gulp-sourcemaps": "^1.6.0", 34 | "gulp-tslint": "^5.0.0", 35 | "gulp-typescript": "^2.13.0", 36 | "typescript": "^1.8.10", 37 | "typings": "^0.8.1", 38 | "superstatic": "^4.0.2", 39 | "tslint": "^3.8.1" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | ((): void => { 2 | 3 | var app = angular.module('demoApp', ['ngRoute', 'ngAnimate']); 4 | 5 | app.config(['$routeProvider', ($routeProvider) => { 6 | $routeProvider.when('/', 7 | { 8 | controller: 'demoApp.CustomersController', 9 | templateUrl: 'app/views/customers.html', 10 | controllerAs: 'vm' 11 | }) 12 | .when('/orders/:customerId', 13 | { 14 | controller: 'demoApp.OrdersController', 15 | templateUrl: 'app/views/orders.html', 16 | controllerAs: 'vm' 17 | }); 18 | }]); 19 | 20 | })(); 21 | -------------------------------------------------------------------------------- /src/app/controllers/customers.controller.ts: -------------------------------------------------------------------------------- 1 | module demoApp { 2 | 'use strict'; 3 | 4 | class CustomersController { 5 | customers: ICustomer[] = null; 6 | 7 | static $inject = ['demoApp.dataService']; 8 | constructor(dataService: DataService) { 9 | dataService.getCustomers() 10 | .then((custs: ICustomer[]) => { 11 | this.customers = custs; 12 | }); 13 | } 14 | } 15 | 16 | angular.module('demoApp') 17 | .controller('demoApp.CustomersController', CustomersController); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/app/controllers/orders.controller.ts: -------------------------------------------------------------------------------- 1 | module demoApp { 2 | 3 | class OrdersController { 4 | 5 | customerId: number; 6 | orders: IOrder[]; 7 | 8 | static $inject = ['$routeParams', 'demoApp.dataService']; 9 | constructor($routeParams, dataService: DataService) { 10 | this.customerId = $routeParams.customerId; 11 | 12 | dataService.getOrder(this.customerId) 13 | .then((orders: IOrder[]) => { 14 | this.orders = orders; 15 | }); 16 | } 17 | } 18 | 19 | angular.module('demoApp') 20 | .controller('demoApp.OrdersController', OrdersController); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/app/directives/filterTextbox.directive.ts: -------------------------------------------------------------------------------- 1 | module demoApp.directives { 2 | 3 | class FilterTextbox implements ng.IDirective { 4 | 5 | static instance() : ng.IDirective { 6 | return new FilterTextbox(); 7 | } 8 | 9 | template = 'Search: {{ vm.message }}'; 10 | restrict = 'E'; 11 | scope = { 12 | filter: '=' 13 | }; 14 | controller: ($scope: ng.IScope) => void; 15 | controllerAs = 'vm'; 16 | bindToController = true; 17 | 18 | constructor() { 19 | this.controller = function ($scope: ng.IScope) { 20 | var vm = this; 21 | vm.message = 'Hello'; 22 | 23 | $scope.$watch('vm.filter', (newVal, oldVal) => { 24 | if (oldVal !== '' && newVal === '') { 25 | vm.message = 'Please enter a value'; 26 | } else { 27 | vm.message = ''; 28 | } 29 | }); 30 | }; 31 | } 32 | } 33 | 34 | angular.module('demoApp').directive('filterTextbox', FilterTextbox.instance); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/app/services/data.service.ts: -------------------------------------------------------------------------------- 1 | module demoApp { 2 | 3 | export interface ICustomer { 4 | id: number; 5 | name: string; 6 | total: number; 7 | } 8 | 9 | export interface IOrder { 10 | product: string; 11 | total: number; 12 | } 13 | 14 | export class DataService { 15 | 16 | static $inject = ['$http']; 17 | constructor(private $http: ng.IHttpService) {} 18 | 19 | getCustomers(): ng.IPromise { 20 | return this.$http.get('customers.json').then(response => { 21 | return response.data; 22 | }); 23 | } 24 | 25 | getOrder(id: number): ng.IPromise { 26 | return this.$http.get('orders.json', {data: { id: id }}).then(response => { 27 | return response.data; 28 | }); 29 | } 30 | } 31 | 32 | angular.module('demoApp') 33 | .service('demoApp.dataService', DataService); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/app/views/customers.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

Customers:

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
NameTotal
{{ cust.name }}{{ cust.total | currency }}
17 |
18 | -------------------------------------------------------------------------------- /src/app/views/orders.html: -------------------------------------------------------------------------------- 1 |

Orders

2 |
3 | CustomerID: {{ vm.customerId }} 4 |

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
ProductTotal
{{order.product}}{{order.total}}
15 | 16 |
17 | 18 | Customers 19 | -------------------------------------------------------------------------------- /src/customers.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"id": 1, "name":"Ted", "total": 5.996}, 3 | {"id": 2, "name":"Michelle", "total": 10.994}, 4 | {"id": 3, "name":"Zed", "total": 10.99}, 5 | {"id": 4, "name":"Tina", "total": 15.994} 6 | ] -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | Angular App 19 | 20 | 21 | 22 | 23 |

AngularJS and TypeScript

24 |
25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/orders.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "product": "Golf Balls", "total": 19.99}, 3 | { "product": "Driver", "total": 219.99} 4 | ] -------------------------------------------------------------------------------- /src/styles/animations.css: -------------------------------------------------------------------------------- 1 | /* Animations */ 2 | .slide-animation-container { 3 | position:relative; 4 | } 5 | 6 | .slide-animation.ng-enter, .slide-animation.ng-leave { 7 | -webkit-transition: 0.5s linear all; 8 | -moz-transition: 0.5s linear all; 9 | -o-transition: 0.5s linear all; 10 | transition: 0.5s linear all; 11 | position:relative; 12 | /*top: 0; 13 | left: 0; 14 | right: 0;*/ 15 | height: 1000px; 16 | } 17 | 18 | .slide-animation.ng-enter { 19 | z-index:100; 20 | left:100px; 21 | opacity:0; 22 | } 23 | 24 | .slide-animation.ng-enter.ng-enter-active { 25 | left:0; 26 | opacity:1; 27 | } 28 | 29 | .slide-animation.ng-leave { 30 | z-index:101; 31 | opacity:1; 32 | left:0; 33 | } 34 | 35 | .slide-animation.ng-leave.ng-leave-active { 36 | left:-100px; 37 | opacity:0; 38 | } 39 | 40 | body.skip-animations * { 41 | -webkit-transition:none!important; 42 | -moz-transition:none!important; 43 | -o-transition:none!important; 44 | transition:none!important; 45 | } 46 | 47 | .show-hide-animation.ng-hide-add, 48 | .show-hide-animation.ng-hide-remove { 49 | -webkit-transition:all linear 0.3s; 50 | -moz-transition:all linear 0.3s; 51 | -o-transition:all linear 0.3s; 52 | transition:all linear 0.3s; 53 | display:block!important; 54 | height: 1000px; 55 | } 56 | 57 | .show-hide-animation.ng-hide-remove { 58 | opacity:0; 59 | } 60 | .show-hide-animation.ng-hide-remove.ng-hide-remove-active { 61 | opacity:1; 62 | } 63 | .show-hide-animation.ng-hide-add { 64 | opacity:1; 65 | } 66 | .show-hide-animation.ng-hide-add.ng-hide-add-active { 67 | opacity:0; 68 | } 69 | 70 | .repeat-animation.ng-enter, 71 | .repeat-animation.ng-leave, 72 | .repeat-animation.ng-move { 73 | -webkit-transition: 0.5s linear all; 74 | -moz-transition: 0.5s linear all; 75 | -o-transition: 0.5s linear all; 76 | transition: 0.5s linear all; 77 | position:relative; 78 | } 79 | 80 | .repeat-animation.ng-enter { 81 | left:10px; 82 | opacity:0; 83 | } 84 | .repeat-animation.ng-enter.ng-enter-active { 85 | left:0; 86 | opacity:1; 87 | } 88 | 89 | .repeat-animation.ng-leave { 90 | left:10px; 91 | opacity:1; 92 | } 93 | .repeat-animation.ng-leave.ng-leave-active { 94 | left:-10px; 95 | opacity:0; 96 | } 97 | 98 | .repeat-animation.ng-move { 99 | opacity:0.5; 100 | } 101 | .repeat-animation.ng-move.ng-move-active { 102 | opacity:1; 103 | } 104 | 105 | body { 106 | margin-left: 20px; 107 | } 108 | 109 | table { 110 | width: 300px; 111 | } -------------------------------------------------------------------------------- /superstatic.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": "src" 3 | } 4 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "sourceMap": true 5 | } 6 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "curly": true, 5 | "eofline": false, 6 | "forin": true, 7 | "indent": [true, 4], 8 | "label-position": true, 9 | "label-undefined": true, 10 | "max-line-length": [true, 140], 11 | "no-arg": true, 12 | "no-bitwise": true, 13 | "no-console": [true, 14 | "debug", 15 | "info", 16 | "time", 17 | "timeEnd", 18 | "trace" 19 | ], 20 | "no-construct": true, 21 | "no-debugger": true, 22 | "no-duplicate-key": true, 23 | "no-duplicate-variable": true, 24 | "no-empty": true, 25 | "no-eval": true, 26 | "no-string-literal": false, 27 | "no-trailing-whitespace": true, 28 | "no-unused-variable": false, 29 | "no-unreachable": true, 30 | "no-use-before-declare": true, 31 | "one-line": [true, 32 | "check-open-brace", 33 | "check-catch", 34 | "check-else", 35 | "check-whitespace" 36 | ], 37 | "quotemark": [true, "single"], 38 | "radix": true, 39 | "semicolon": true, 40 | "triple-equals": [true, "allow-null-check"], 41 | "variable-name": false, 42 | "whitespace": [true, 43 | "check-branch", 44 | "check-decl", 45 | "check-operator", 46 | "check-separator" 47 | ] 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "angular": "registry:dt/angular#1.5.0+20160412133217", 4 | "angular-animate": "registry:dt/angular-animate#1.5.0+20160407085121", 5 | "angular-route": "registry:dt/angular-route#1.3.0+20160317120654", 6 | "jquery": "registry:dt/jquery#1.10.0+20160417213236" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/browser.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /typings/browser/ambient/angular-animate/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts 3 | // Type definitions for Angular JS 1.5 (ngAnimate module) 4 | // Project: http://angularjs.org 5 | // Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | declare module "angular-animate" { 10 | var _: string; 11 | export = _; 12 | } 13 | 14 | /** 15 | * ngAnimate module (angular-animate.js) 16 | */ 17 | declare namespace angular.animate { 18 | interface IAnimateFactory { 19 | (...args: any[]): IAnimateCallbackObject; 20 | } 21 | 22 | interface IAnimateCallbackObject { 23 | eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 24 | setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; 25 | addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; 26 | removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; 27 | enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 28 | leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 29 | move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 30 | animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any; 31 | } 32 | 33 | interface IAnimationPromise extends IPromise {} 34 | 35 | /** 36 | * AnimateService 37 | * see http://docs.angularjs.org/api/ngAnimate/service/$animate 38 | */ 39 | interface IAnimateService { 40 | /** 41 | * Sets up an event listener to fire whenever the animation event has fired on the given element or among any of its children. 42 | * 43 | * @param event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) 44 | * @param container the container element that will capture each of the animation events that are fired on itself as well as among its children 45 | * @param callback the callback function that will be fired when the listener is triggered 46 | */ 47 | on(event: string, container: JQuery, callback: Function): void; 48 | 49 | /** 50 | * Deregisters an event listener based on the event which has been associated with the provided element. 51 | * 52 | * @param event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...) 53 | * @param container the container element the event listener was placed on 54 | * @param callback the callback function that was registered as the listener 55 | */ 56 | off(event: string, container?: JQuery, callback?: Function): void; 57 | 58 | /** 59 | * Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application. 60 | * 61 | * @param element the external element that will be pinned 62 | * @param parentElement the host parent element that will be associated with the external element 63 | */ 64 | pin(element: JQuery, parentElement: JQuery): void; 65 | 66 | /** 67 | * Globally enables / disables animations. 68 | * 69 | * @param element If provided then the element will be used to represent the enable/disable operation. 70 | * @param value If provided then set the animation on or off. 71 | * @returns current animation state 72 | */ 73 | enabled(element: JQuery, value?: boolean): boolean; 74 | enabled(value: boolean): boolean; 75 | 76 | /** 77 | * Cancels the provided animation. 78 | */ 79 | cancel(animationPromise: IAnimationPromise): void; 80 | 81 | /** 82 | * Performs an inline animation on the element. 83 | * 84 | * @param element the element that will be the focus of the animation 85 | * @param from a collection of CSS styles that will be applied to the element at the start of the animation 86 | * @param to a collection of CSS styles that the element will animate towards 87 | * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') 88 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 89 | * @returns the animation callback promise 90 | */ 91 | animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IAnimationPromise; 92 | 93 | /** 94 | * Appends the element to the parentElement element that resides in the document and then runs the enter animation. 95 | * 96 | * @param element the element that will be the focus of the enter animation 97 | * @param parentElement the parent element of the element that will be the focus of the enter animation 98 | * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation 99 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 100 | * @returns the animation callback promise 101 | */ 102 | enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IAnimationPromise; 103 | 104 | /** 105 | * Runs the leave animation operation and, upon completion, removes the element from the DOM. 106 | * 107 | * @param element the element that will be the focus of the leave animation 108 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 109 | * @returns the animation callback promise 110 | */ 111 | leave(element: JQuery, options?: IAnimationOptions): IAnimationPromise; 112 | 113 | /** 114 | * Fires the move DOM operation. Just before the animation starts, the animate service will either append 115 | * it into the parentElement container or add the element directly after the afterElement element if present. 116 | * Then the move animation will be run. 117 | * 118 | * @param element the element that will be the focus of the move animation 119 | * @param parentElement the parent element of the element that will be the focus of the move animation 120 | * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation 121 | * @returns the animation callback promise 122 | */ 123 | move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IAnimationPromise; 124 | 125 | /** 126 | * Triggers a custom animation event based off the className variable and then attaches the className 127 | * value to the element as a CSS class. 128 | * 129 | * @param element the element that will be animated 130 | * @param className the CSS class that will be added to the element and then animated 131 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 132 | * @returns the animation callback promise 133 | */ 134 | addClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; 135 | 136 | /** 137 | * Triggers a custom animation event based off the className variable and then removes the CSS class 138 | * provided by the className value from the element. 139 | * 140 | * @param element the element that will be animated 141 | * @param className the CSS class that will be animated and then removed from the element 142 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 143 | * @returns the animation callback promise 144 | */ 145 | removeClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; 146 | 147 | /** 148 | * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback 149 | * will be fired (if provided). 150 | * 151 | * @param element the element which will have its CSS classes changed removed from it 152 | * @param add the CSS classes which will be added to the element 153 | * @param remove the CSS class which will be removed from the element CSS classes have been set on the element 154 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 155 | * @returns the animation callback promise 156 | */ 157 | setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IAnimationPromise; 158 | } 159 | 160 | /** 161 | * AnimateProvider 162 | * see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider 163 | */ 164 | interface IAnimateProvider { 165 | /** 166 | * Registers a new injectable animation factory function. 167 | * 168 | * @param name The name of the animation. 169 | * @param factory The factory function that will be executed to return the animation object. 170 | */ 171 | register(name: string, factory: IAnimateFactory): void; 172 | 173 | /** 174 | * Gets and/or sets the CSS class expression that is checked when performing an animation. 175 | * 176 | * @param expression The className expression which will be checked against all animations. 177 | * @returns The current CSS className expression value. If null then there is no expression value. 178 | */ 179 | classNameFilter(expression?: RegExp): RegExp; 180 | } 181 | 182 | /** 183 | * Angular Animation Options 184 | * see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation 185 | */ 186 | interface IAnimationOptions { 187 | /** 188 | * The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. 189 | */ 190 | to?: Object; 191 | 192 | /** 193 | * The starting CSS styles (a key/value object) that will be applied at the start of the animation. 194 | */ 195 | from?: Object; 196 | 197 | /** 198 | * The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and 199 | * ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when 200 | * spaces are used as a separator. (Note that this will not perform any DOM operation.) 201 | */ 202 | event?: string; 203 | 204 | /** 205 | * The CSS easing value that will be applied to the transition or keyframe animation (or both). 206 | */ 207 | easing?: string; 208 | 209 | /** 210 | * The raw CSS transition style that will be used (e.g. 1s linear all). 211 | */ 212 | transition?: string; 213 | 214 | /** 215 | * The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear). 216 | */ 217 | keyframe?: string; 218 | 219 | /** 220 | * A space separated list of CSS classes that will be added to the element and spread across the animation. 221 | */ 222 | addClass?: string; 223 | 224 | /** 225 | * A space separated list of CSS classes that will be removed from the element and spread across 226 | * the animation. 227 | */ 228 | removeClass?: string; 229 | 230 | /** 231 | * A number value representing the total duration of the transition and/or keyframe (note that a value 232 | * of 1 is 1000ms). If a value of 0 is provided then the animation will be skipped entirely. 233 | */ 234 | duration?: number; 235 | 236 | /** 237 | * A number value representing the total delay of the transition and/or keyframe (note that a value of 238 | * 1 is 1000ms). If a value of true is used then whatever delay value is detected from the CSS classes will be 239 | * mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be 240 | * transition-delay: DETECTED_VALUE). Using true is useful when you want the CSS classes and inline styles to 241 | * all share the same CSS delay value. 242 | */ 243 | delay?: number; 244 | 245 | /** 246 | * A numeric time value representing the delay between successively animated elements (Click here to 247 | * learn how CSS-based staggering works in ngAnimate.) 248 | */ 249 | stagger?: number; 250 | 251 | /** 252 | * The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item 253 | * in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms) 254 | * applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation. 255 | * This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. 256 | * (Note that this will prevent any transitions from occuring on the classes being added and removed.) 257 | */ 258 | staggerIndex?: number; 259 | } 260 | 261 | interface IAnimateCssRunner { 262 | /** 263 | * Starts the animation 264 | * 265 | * @returns The animation runner with a done function for supplying a callback. 266 | */ 267 | start(): IAnimateCssRunnerStart; 268 | 269 | /** 270 | * Ends (aborts) the animation 271 | */ 272 | end(): void; 273 | } 274 | 275 | interface IAnimateCssRunnerStart extends IPromise { 276 | /** 277 | * Allows you to add done callbacks to the running animation 278 | * 279 | * @param callbackFn: the callback function to be run 280 | */ 281 | done(callbackFn: (animationFinished: boolean) => void): void; 282 | } 283 | 284 | /** 285 | * AnimateCssService 286 | * see http://docs.angularjs.org/api/ngAnimate/service/$animateCss 287 | */ 288 | interface IAnimateCssService { 289 | (element: JQuery, animateCssOptions: IAnimationOptions): IAnimateCssRunner; 290 | } 291 | } 292 | 293 | declare module angular { 294 | interface IModule { 295 | animation(name: string, animationFactory: angular.animate.IAnimateFactory): IModule; 296 | animation(name: string, inlineAnnotatedFunction: any[]): IModule; 297 | animation(object: Object): IModule; 298 | } 299 | 300 | } -------------------------------------------------------------------------------- /typings/browser/ambient/angular-route/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts 3 | // Type definitions for Angular JS 1.3 (ngRoute module) 4 | // Project: http://angularjs.org 5 | // Definitions by: Jonathan Park 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | declare module "angular-route" { 10 | var _: string; 11 | export = _; 12 | } 13 | 14 | /////////////////////////////////////////////////////////////////////////////// 15 | // ngRoute module (angular-route.js) 16 | /////////////////////////////////////////////////////////////////////////////// 17 | declare namespace angular.route { 18 | 19 | /////////////////////////////////////////////////////////////////////////// 20 | // RouteParamsService 21 | // see http://docs.angularjs.org/api/ngRoute.$routeParams 22 | /////////////////////////////////////////////////////////////////////////// 23 | interface IRouteParamsService { 24 | [key: string]: any; 25 | } 26 | 27 | /////////////////////////////////////////////////////////////////////////// 28 | // RouteService 29 | // see http://docs.angularjs.org/api/ngRoute.$route 30 | // see http://docs.angularjs.org/api/ngRoute.$routeProvider 31 | /////////////////////////////////////////////////////////////////////////// 32 | interface IRouteService { 33 | reload(): void; 34 | routes: any; 35 | 36 | // May not always be available. For instance, current will not be available 37 | // to a controller that was not initialized as a result of a route maching. 38 | current?: ICurrentRoute; 39 | 40 | /** 41 | * Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. 42 | * Provided property names that match the route's path segment definitions will be interpolated into the 43 | * location's path, while remaining properties will be treated as query params. 44 | * 45 | * @param newParams Object. mapping of URL parameter names to values 46 | */ 47 | updateParams(newParams:{[key:string]:string}): void; 48 | 49 | } 50 | 51 | type InlineAnnotatedFunction = Function|Array 52 | 53 | /** 54 | * see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation 55 | */ 56 | interface IRoute { 57 | /** 58 | * {(string|function()=} 59 | * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. 60 | */ 61 | controller?: string|InlineAnnotatedFunction; 62 | /** 63 | * A controller alias name. If present the controller will be published to scope under the controllerAs name. 64 | */ 65 | controllerAs?: string; 66 | /** 67 | * Undocumented? 68 | */ 69 | name?: string; 70 | /** 71 | * {string=|function()=} 72 | * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. 73 | * 74 | * If template is a function, it will be called with the following parameters: 75 | * 76 | * {Array.} - route parameters extracted from the current $location.path() by applying the current route 77 | */ 78 | template?: string|{($routeParams?: angular.route.IRouteParamsService) : string;} 79 | /** 80 | * {string=|function()=} 81 | * Path or function that returns a path to an html template that should be used by ngView. 82 | * 83 | * If templateUrl is a function, it will be called with the following parameters: 84 | * 85 | * {Array.} - route parameters extracted from the current $location.path() by applying the current route 86 | */ 87 | templateUrl?: string|{ ($routeParams?: angular.route.IRouteParamsService): string; } 88 | /** 89 | * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: 90 | * 91 | * - key - {string}: a name of a dependency to be injected into the controller. 92 | * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. 93 | */ 94 | resolve?: {[key: string]: any}; 95 | /** 96 | * {(string|function())=} 97 | * Value to update $location path with and trigger route redirection. 98 | * 99 | * If redirectTo is a function, it will be called with the following parameters: 100 | * 101 | * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. 102 | * - {string} - current $location.path() 103 | * - {Object} - current $location.search() 104 | * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). 105 | */ 106 | redirectTo?: string|{($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; 107 | /** 108 | * Reload route when only $location.search() or $location.hash() changes. 109 | * 110 | * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. 111 | */ 112 | reloadOnSearch?: boolean; 113 | /** 114 | * Match routes without being case sensitive 115 | * 116 | * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive 117 | */ 118 | caseInsensitiveMatch?: boolean; 119 | } 120 | 121 | // see http://docs.angularjs.org/api/ng.$route#current 122 | interface ICurrentRoute extends IRoute { 123 | locals: { 124 | [index: string]: any; 125 | $scope: IScope; 126 | $template: string; 127 | }; 128 | 129 | params: any; 130 | } 131 | 132 | interface IRouteProvider extends IServiceProvider { 133 | /** 134 | * Match routes without being case sensitive 135 | * 136 | * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive 137 | */ 138 | caseInsensitiveMatch?: boolean; 139 | /** 140 | * Sets route definition that will be used on route change when no other route definition is matched. 141 | * 142 | * @params Mapping information to be assigned to $route.current. 143 | */ 144 | otherwise(params: IRoute): IRouteProvider; 145 | /** 146 | * Adds a new route definition to the $route service. 147 | * 148 | * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. 149 | * 150 | * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. 151 | * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. 152 | * - path can contain optional named groups with a question mark: e.g.:name?. 153 | * 154 | * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. 155 | * 156 | * @param route Mapping information to be assigned to $route.current on route match. 157 | */ 158 | when(path: string, route: IRoute): IRouteProvider; 159 | } 160 | } -------------------------------------------------------------------------------- /typings/main.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /typings/main/ambient/angular-animate/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts 3 | // Type definitions for Angular JS 1.5 (ngAnimate module) 4 | // Project: http://angularjs.org 5 | // Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | declare module "angular-animate" { 10 | var _: string; 11 | export = _; 12 | } 13 | 14 | /** 15 | * ngAnimate module (angular-animate.js) 16 | */ 17 | declare namespace angular.animate { 18 | interface IAnimateFactory { 19 | (...args: any[]): IAnimateCallbackObject; 20 | } 21 | 22 | interface IAnimateCallbackObject { 23 | eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 24 | setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; 25 | addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; 26 | removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; 27 | enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 28 | leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 29 | move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any; 30 | animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any; 31 | } 32 | 33 | interface IAnimationPromise extends IPromise {} 34 | 35 | /** 36 | * AnimateService 37 | * see http://docs.angularjs.org/api/ngAnimate/service/$animate 38 | */ 39 | interface IAnimateService { 40 | /** 41 | * Sets up an event listener to fire whenever the animation event has fired on the given element or among any of its children. 42 | * 43 | * @param event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...) 44 | * @param container the container element that will capture each of the animation events that are fired on itself as well as among its children 45 | * @param callback the callback function that will be fired when the listener is triggered 46 | */ 47 | on(event: string, container: JQuery, callback: Function): void; 48 | 49 | /** 50 | * Deregisters an event listener based on the event which has been associated with the provided element. 51 | * 52 | * @param event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...) 53 | * @param container the container element the event listener was placed on 54 | * @param callback the callback function that was registered as the listener 55 | */ 56 | off(event: string, container?: JQuery, callback?: Function): void; 57 | 58 | /** 59 | * Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application. 60 | * 61 | * @param element the external element that will be pinned 62 | * @param parentElement the host parent element that will be associated with the external element 63 | */ 64 | pin(element: JQuery, parentElement: JQuery): void; 65 | 66 | /** 67 | * Globally enables / disables animations. 68 | * 69 | * @param element If provided then the element will be used to represent the enable/disable operation. 70 | * @param value If provided then set the animation on or off. 71 | * @returns current animation state 72 | */ 73 | enabled(element: JQuery, value?: boolean): boolean; 74 | enabled(value: boolean): boolean; 75 | 76 | /** 77 | * Cancels the provided animation. 78 | */ 79 | cancel(animationPromise: IAnimationPromise): void; 80 | 81 | /** 82 | * Performs an inline animation on the element. 83 | * 84 | * @param element the element that will be the focus of the animation 85 | * @param from a collection of CSS styles that will be applied to the element at the start of the animation 86 | * @param to a collection of CSS styles that the element will animate towards 87 | * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') 88 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 89 | * @returns the animation callback promise 90 | */ 91 | animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IAnimationPromise; 92 | 93 | /** 94 | * Appends the element to the parentElement element that resides in the document and then runs the enter animation. 95 | * 96 | * @param element the element that will be the focus of the enter animation 97 | * @param parentElement the parent element of the element that will be the focus of the enter animation 98 | * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation 99 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 100 | * @returns the animation callback promise 101 | */ 102 | enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IAnimationPromise; 103 | 104 | /** 105 | * Runs the leave animation operation and, upon completion, removes the element from the DOM. 106 | * 107 | * @param element the element that will be the focus of the leave animation 108 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 109 | * @returns the animation callback promise 110 | */ 111 | leave(element: JQuery, options?: IAnimationOptions): IAnimationPromise; 112 | 113 | /** 114 | * Fires the move DOM operation. Just before the animation starts, the animate service will either append 115 | * it into the parentElement container or add the element directly after the afterElement element if present. 116 | * Then the move animation will be run. 117 | * 118 | * @param element the element that will be the focus of the move animation 119 | * @param parentElement the parent element of the element that will be the focus of the move animation 120 | * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation 121 | * @returns the animation callback promise 122 | */ 123 | move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IAnimationPromise; 124 | 125 | /** 126 | * Triggers a custom animation event based off the className variable and then attaches the className 127 | * value to the element as a CSS class. 128 | * 129 | * @param element the element that will be animated 130 | * @param className the CSS class that will be added to the element and then animated 131 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 132 | * @returns the animation callback promise 133 | */ 134 | addClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; 135 | 136 | /** 137 | * Triggers a custom animation event based off the className variable and then removes the CSS class 138 | * provided by the className value from the element. 139 | * 140 | * @param element the element that will be animated 141 | * @param className the CSS class that will be animated and then removed from the element 142 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 143 | * @returns the animation callback promise 144 | */ 145 | removeClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise; 146 | 147 | /** 148 | * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback 149 | * will be fired (if provided). 150 | * 151 | * @param element the element which will have its CSS classes changed removed from it 152 | * @param add the CSS classes which will be added to the element 153 | * @param remove the CSS class which will be removed from the element CSS classes have been set on the element 154 | * @param options an optional collection of styles that will be picked up by the CSS transition/animation 155 | * @returns the animation callback promise 156 | */ 157 | setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IAnimationPromise; 158 | } 159 | 160 | /** 161 | * AnimateProvider 162 | * see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider 163 | */ 164 | interface IAnimateProvider { 165 | /** 166 | * Registers a new injectable animation factory function. 167 | * 168 | * @param name The name of the animation. 169 | * @param factory The factory function that will be executed to return the animation object. 170 | */ 171 | register(name: string, factory: IAnimateFactory): void; 172 | 173 | /** 174 | * Gets and/or sets the CSS class expression that is checked when performing an animation. 175 | * 176 | * @param expression The className expression which will be checked against all animations. 177 | * @returns The current CSS className expression value. If null then there is no expression value. 178 | */ 179 | classNameFilter(expression?: RegExp): RegExp; 180 | } 181 | 182 | /** 183 | * Angular Animation Options 184 | * see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation 185 | */ 186 | interface IAnimationOptions { 187 | /** 188 | * The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. 189 | */ 190 | to?: Object; 191 | 192 | /** 193 | * The starting CSS styles (a key/value object) that will be applied at the start of the animation. 194 | */ 195 | from?: Object; 196 | 197 | /** 198 | * The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and 199 | * ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when 200 | * spaces are used as a separator. (Note that this will not perform any DOM operation.) 201 | */ 202 | event?: string; 203 | 204 | /** 205 | * The CSS easing value that will be applied to the transition or keyframe animation (or both). 206 | */ 207 | easing?: string; 208 | 209 | /** 210 | * The raw CSS transition style that will be used (e.g. 1s linear all). 211 | */ 212 | transition?: string; 213 | 214 | /** 215 | * The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear). 216 | */ 217 | keyframe?: string; 218 | 219 | /** 220 | * A space separated list of CSS classes that will be added to the element and spread across the animation. 221 | */ 222 | addClass?: string; 223 | 224 | /** 225 | * A space separated list of CSS classes that will be removed from the element and spread across 226 | * the animation. 227 | */ 228 | removeClass?: string; 229 | 230 | /** 231 | * A number value representing the total duration of the transition and/or keyframe (note that a value 232 | * of 1 is 1000ms). If a value of 0 is provided then the animation will be skipped entirely. 233 | */ 234 | duration?: number; 235 | 236 | /** 237 | * A number value representing the total delay of the transition and/or keyframe (note that a value of 238 | * 1 is 1000ms). If a value of true is used then whatever delay value is detected from the CSS classes will be 239 | * mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be 240 | * transition-delay: DETECTED_VALUE). Using true is useful when you want the CSS classes and inline styles to 241 | * all share the same CSS delay value. 242 | */ 243 | delay?: number; 244 | 245 | /** 246 | * A numeric time value representing the delay between successively animated elements (Click here to 247 | * learn how CSS-based staggering works in ngAnimate.) 248 | */ 249 | stagger?: number; 250 | 251 | /** 252 | * The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item 253 | * in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms) 254 | * applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation. 255 | * This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. 256 | * (Note that this will prevent any transitions from occuring on the classes being added and removed.) 257 | */ 258 | staggerIndex?: number; 259 | } 260 | 261 | interface IAnimateCssRunner { 262 | /** 263 | * Starts the animation 264 | * 265 | * @returns The animation runner with a done function for supplying a callback. 266 | */ 267 | start(): IAnimateCssRunnerStart; 268 | 269 | /** 270 | * Ends (aborts) the animation 271 | */ 272 | end(): void; 273 | } 274 | 275 | interface IAnimateCssRunnerStart extends IPromise { 276 | /** 277 | * Allows you to add done callbacks to the running animation 278 | * 279 | * @param callbackFn: the callback function to be run 280 | */ 281 | done(callbackFn: (animationFinished: boolean) => void): void; 282 | } 283 | 284 | /** 285 | * AnimateCssService 286 | * see http://docs.angularjs.org/api/ngAnimate/service/$animateCss 287 | */ 288 | interface IAnimateCssService { 289 | (element: JQuery, animateCssOptions: IAnimationOptions): IAnimateCssRunner; 290 | } 291 | } 292 | 293 | declare module angular { 294 | interface IModule { 295 | animation(name: string, animationFactory: angular.animate.IAnimateFactory): IModule; 296 | animation(name: string, inlineAnnotatedFunction: any[]): IModule; 297 | animation(object: Object): IModule; 298 | } 299 | 300 | } -------------------------------------------------------------------------------- /typings/main/ambient/angular-route/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts 3 | // Type definitions for Angular JS 1.3 (ngRoute module) 4 | // Project: http://angularjs.org 5 | // Definitions by: Jonathan Park 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | declare module "angular-route" { 10 | var _: string; 11 | export = _; 12 | } 13 | 14 | /////////////////////////////////////////////////////////////////////////////// 15 | // ngRoute module (angular-route.js) 16 | /////////////////////////////////////////////////////////////////////////////// 17 | declare namespace angular.route { 18 | 19 | /////////////////////////////////////////////////////////////////////////// 20 | // RouteParamsService 21 | // see http://docs.angularjs.org/api/ngRoute.$routeParams 22 | /////////////////////////////////////////////////////////////////////////// 23 | interface IRouteParamsService { 24 | [key: string]: any; 25 | } 26 | 27 | /////////////////////////////////////////////////////////////////////////// 28 | // RouteService 29 | // see http://docs.angularjs.org/api/ngRoute.$route 30 | // see http://docs.angularjs.org/api/ngRoute.$routeProvider 31 | /////////////////////////////////////////////////////////////////////////// 32 | interface IRouteService { 33 | reload(): void; 34 | routes: any; 35 | 36 | // May not always be available. For instance, current will not be available 37 | // to a controller that was not initialized as a result of a route maching. 38 | current?: ICurrentRoute; 39 | 40 | /** 41 | * Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. 42 | * Provided property names that match the route's path segment definitions will be interpolated into the 43 | * location's path, while remaining properties will be treated as query params. 44 | * 45 | * @param newParams Object. mapping of URL parameter names to values 46 | */ 47 | updateParams(newParams:{[key:string]:string}): void; 48 | 49 | } 50 | 51 | type InlineAnnotatedFunction = Function|Array 52 | 53 | /** 54 | * see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation 55 | */ 56 | interface IRoute { 57 | /** 58 | * {(string|function()=} 59 | * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. 60 | */ 61 | controller?: string|InlineAnnotatedFunction; 62 | /** 63 | * A controller alias name. If present the controller will be published to scope under the controllerAs name. 64 | */ 65 | controllerAs?: string; 66 | /** 67 | * Undocumented? 68 | */ 69 | name?: string; 70 | /** 71 | * {string=|function()=} 72 | * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. 73 | * 74 | * If template is a function, it will be called with the following parameters: 75 | * 76 | * {Array.} - route parameters extracted from the current $location.path() by applying the current route 77 | */ 78 | template?: string|{($routeParams?: angular.route.IRouteParamsService) : string;} 79 | /** 80 | * {string=|function()=} 81 | * Path or function that returns a path to an html template that should be used by ngView. 82 | * 83 | * If templateUrl is a function, it will be called with the following parameters: 84 | * 85 | * {Array.} - route parameters extracted from the current $location.path() by applying the current route 86 | */ 87 | templateUrl?: string|{ ($routeParams?: angular.route.IRouteParamsService): string; } 88 | /** 89 | * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: 90 | * 91 | * - key - {string}: a name of a dependency to be injected into the controller. 92 | * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. 93 | */ 94 | resolve?: {[key: string]: any}; 95 | /** 96 | * {(string|function())=} 97 | * Value to update $location path with and trigger route redirection. 98 | * 99 | * If redirectTo is a function, it will be called with the following parameters: 100 | * 101 | * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. 102 | * - {string} - current $location.path() 103 | * - {Object} - current $location.search() 104 | * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). 105 | */ 106 | redirectTo?: string|{($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; 107 | /** 108 | * Reload route when only $location.search() or $location.hash() changes. 109 | * 110 | * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. 111 | */ 112 | reloadOnSearch?: boolean; 113 | /** 114 | * Match routes without being case sensitive 115 | * 116 | * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive 117 | */ 118 | caseInsensitiveMatch?: boolean; 119 | } 120 | 121 | // see http://docs.angularjs.org/api/ng.$route#current 122 | interface ICurrentRoute extends IRoute { 123 | locals: { 124 | [index: string]: any; 125 | $scope: IScope; 126 | $template: string; 127 | }; 128 | 129 | params: any; 130 | } 131 | 132 | interface IRouteProvider extends IServiceProvider { 133 | /** 134 | * Match routes without being case sensitive 135 | * 136 | * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive 137 | */ 138 | caseInsensitiveMatch?: boolean; 139 | /** 140 | * Sets route definition that will be used on route change when no other route definition is matched. 141 | * 142 | * @params Mapping information to be assigned to $route.current. 143 | */ 144 | otherwise(params: IRoute): IRouteProvider; 145 | /** 146 | * Adds a new route definition to the $route service. 147 | * 148 | * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. 149 | * 150 | * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. 151 | * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. 152 | * - path can contain optional named groups with a question mark: e.g.:name?. 153 | * 154 | * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. 155 | * 156 | * @param route Mapping information to be assigned to $route.current on route match. 157 | */ 158 | when(path: string, route: IRoute): IRouteProvider; 159 | } 160 | } -------------------------------------------------------------------------------- /typings/main/ambient/angular/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/fa3294c560ee49f4af43e02a62e3f4b5b6bbe5e5/angularjs/angular.d.ts 3 | // Type definitions for Angular JS 1.5 4 | // Project: http://angularjs.org 5 | // Definitions by: Diego Vilar 6 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 7 | 8 | 9 | 10 | declare var angular: angular.IAngularStatic; 11 | 12 | // Support for painless dependency injection 13 | interface Function { 14 | $inject?: string[]; 15 | } 16 | 17 | // Collapse angular into ng 18 | import ng = angular; 19 | // Support AMD require 20 | declare module 'angular' { 21 | export = angular; 22 | } 23 | 24 | /////////////////////////////////////////////////////////////////////////////// 25 | // ng module (angular.js) 26 | /////////////////////////////////////////////////////////////////////////////// 27 | declare namespace angular { 28 | 29 | // not directly implemented, but ensures that constructed class implements $get 30 | interface IServiceProviderClass { 31 | new (...args: any[]): IServiceProvider; 32 | } 33 | 34 | interface IServiceProviderFactory { 35 | (...args: any[]): IServiceProvider; 36 | } 37 | 38 | // All service providers extend this interface 39 | interface IServiceProvider { 40 | $get: any; 41 | } 42 | 43 | interface IAngularBootstrapConfig { 44 | strictDi?: boolean; 45 | debugInfoEnabled?: boolean; 46 | } 47 | 48 | /////////////////////////////////////////////////////////////////////////// 49 | // AngularStatic 50 | // see http://docs.angularjs.org/api 51 | /////////////////////////////////////////////////////////////////////////// 52 | interface IAngularStatic { 53 | bind(context: any, fn: Function, ...args: any[]): Function; 54 | 55 | /** 56 | * Use this function to manually start up angular application. 57 | * 58 | * @param element DOM element which is the root of angular application. 59 | * @param modules An array of modules to load into the application. 60 | * Each item in the array should be the name of a predefined module or a (DI annotated) 61 | * function that will be invoked by the injector as a config block. 62 | * @param config an object for defining configuration options for the application. The following keys are supported: 63 | * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. 64 | */ 65 | bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService; 66 | 67 | /** 68 | * Creates a deep copy of source, which should be an object or an array. 69 | * 70 | * - If no destination is supplied, a copy of the object or array is created. 71 | * - If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it. 72 | * - If source is not an object or array (inc. null and undefined), source is returned. 73 | * - If source is identical to 'destination' an exception will be thrown. 74 | * 75 | * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined. 76 | * @param destination Destination into which the source is copied. If provided, must be of the same type as source. 77 | */ 78 | copy(source: T, destination?: T): T; 79 | 80 | /** 81 | * Wraps a raw DOM element or HTML string as a jQuery element. 82 | * 83 | * If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." 84 | */ 85 | element: IAugmentedJQueryStatic; 86 | equals(value1: any, value2: any): boolean; 87 | extend(destination: any, ...sources: any[]): any; 88 | 89 | /** 90 | * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. 91 | * 92 | * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. 93 | * 94 | * @param obj Object to iterate over. 95 | * @param iterator Iterator function. 96 | * @param context Object to become context (this) for the iterator function. 97 | */ 98 | forEach(obj: T[], iterator: (value: T, key: number) => any, context?: any): any; 99 | /** 100 | * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. 101 | * 102 | * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. 103 | * 104 | * @param obj Object to iterate over. 105 | * @param iterator Iterator function. 106 | * @param context Object to become context (this) for the iterator function. 107 | */ 108 | forEach(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any; 109 | /** 110 | * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. 111 | * 112 | * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. 113 | * 114 | * @param obj Object to iterate over. 115 | * @param iterator Iterator function. 116 | * @param context Object to become context (this) for the iterator function. 117 | */ 118 | forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; 119 | 120 | fromJson(json: string): any; 121 | identity(arg?: T): T; 122 | injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; 123 | isArray(value: any): boolean; 124 | isDate(value: any): boolean; 125 | isDefined(value: any): boolean; 126 | isElement(value: any): boolean; 127 | isFunction(value: any): boolean; 128 | isNumber(value: any): boolean; 129 | isObject(value: any): boolean; 130 | isString(value: any): boolean; 131 | isUndefined(value: any): boolean; 132 | lowercase(str: string): string; 133 | 134 | /** 135 | * Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2). 136 | * 137 | * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. 138 | * 139 | * @param dst Destination object. 140 | * @param src Source object(s). 141 | */ 142 | merge(dst: any, ...src: any[]): any; 143 | 144 | /** 145 | * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. 146 | * 147 | * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. 148 | * 149 | * @param name The name of the module to create or retrieve. 150 | * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. 151 | * @param configFn Optional configuration function for the module. 152 | */ 153 | module( 154 | name: string, 155 | requires?: string[], 156 | configFn?: Function): IModule; 157 | 158 | noop(...args: any[]): void; 159 | reloadWithDebugInfo(): void; 160 | toJson(obj: any, pretty?: boolean): string; 161 | uppercase(str: string): string; 162 | version: { 163 | full: string; 164 | major: number; 165 | minor: number; 166 | dot: number; 167 | codeName: string; 168 | }; 169 | 170 | /** 171 | * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. 172 | * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. 173 | */ 174 | resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; 175 | } 176 | 177 | /////////////////////////////////////////////////////////////////////////// 178 | // Module 179 | // see http://docs.angularjs.org/api/angular.Module 180 | /////////////////////////////////////////////////////////////////////////// 181 | interface IModule { 182 | /** 183 | * Use this method to register a component. 184 | * 185 | * @param name The name of the component. 186 | * @param options A definition object passed into the component. 187 | */ 188 | component(name: string, options: IComponentOptions): IModule; 189 | /** 190 | * Use this method to register work which needs to be performed on module loading. 191 | * 192 | * @param configFn Execute this function on module load. Useful for service configuration. 193 | */ 194 | config(configFn: Function): IModule; 195 | /** 196 | * Use this method to register work which needs to be performed on module loading. 197 | * 198 | * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. 199 | */ 200 | config(inlineAnnotatedFunction: any[]): IModule; 201 | config(object: Object): IModule; 202 | /** 203 | * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. 204 | * 205 | * @param name The name of the constant. 206 | * @param value The constant value. 207 | */ 208 | constant(name: string, value: T): IModule; 209 | constant(object: Object): IModule; 210 | /** 211 | * The $controller service is used by Angular to create new controllers. 212 | * 213 | * This provider allows controller registration via the register method. 214 | * 215 | * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. 216 | * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). 217 | */ 218 | controller(name: string, controllerConstructor: Function): IModule; 219 | /** 220 | * The $controller service is used by Angular to create new controllers. 221 | * 222 | * This provider allows controller registration via the register method. 223 | * 224 | * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. 225 | * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). 226 | */ 227 | controller(name: string, inlineAnnotatedConstructor: any[]): IModule; 228 | controller(object: Object): IModule; 229 | /** 230 | * Register a new directive with the compiler. 231 | * 232 | * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) 233 | * @param directiveFactory An injectable directive factory function. 234 | */ 235 | directive(name: string, directiveFactory: IDirectiveFactory): IModule; 236 | /** 237 | * Register a new directive with the compiler. 238 | * 239 | * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) 240 | * @param directiveFactory An injectable directive factory function. 241 | */ 242 | directive(name: string, inlineAnnotatedFunction: any[]): IModule; 243 | directive(object: Object): IModule; 244 | /** 245 | * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. 246 | * 247 | * @param name The name of the instance. 248 | * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). 249 | */ 250 | factory(name: string, $getFn: Function): IModule; 251 | /** 252 | * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. 253 | * 254 | * @param name The name of the instance. 255 | * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). 256 | */ 257 | factory(name: string, inlineAnnotatedFunction: any[]): IModule; 258 | factory(object: Object): IModule; 259 | filter(name: string, filterFactoryFunction: Function): IModule; 260 | filter(name: string, inlineAnnotatedFunction: any[]): IModule; 261 | filter(object: Object): IModule; 262 | provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; 263 | provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; 264 | provider(name: string, inlineAnnotatedConstructor: any[]): IModule; 265 | provider(name: string, providerObject: IServiceProvider): IModule; 266 | provider(object: Object): IModule; 267 | /** 268 | * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. 269 | */ 270 | run(initializationFunction: Function): IModule; 271 | /** 272 | * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. 273 | */ 274 | run(inlineAnnotatedFunction: any[]): IModule; 275 | /** 276 | * Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function. 277 | * 278 | * @param name The name of the instance. 279 | * @param serviceConstructor An injectable class (constructor function) that will be instantiated. 280 | */ 281 | service(name: string, serviceConstructor: Function): IModule; 282 | /** 283 | * Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function. 284 | * 285 | * @param name The name of the instance. 286 | * @param inlineAnnotatedConstructor An injectable class (constructor function) that will be instantiated. 287 | */ 288 | service(name: string, inlineAnnotatedConstructor: any[]): IModule; 289 | service(object: Object): IModule; 290 | /** 291 | * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. 292 | 293 | Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. 294 | * 295 | * @param name The name of the instance. 296 | * @param value The value. 297 | */ 298 | value(name: string, value: T): IModule; 299 | value(object: Object): IModule; 300 | 301 | /** 302 | * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. 303 | * @param name The name of the service to decorate 304 | * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. 305 | */ 306 | decorator(name:string, decoratorConstructor: Function): IModule; 307 | decorator(name:string, inlineAnnotatedConstructor: any[]): IModule; 308 | 309 | // Properties 310 | name: string; 311 | requires: string[]; 312 | } 313 | 314 | /////////////////////////////////////////////////////////////////////////// 315 | // Attributes 316 | // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes 317 | /////////////////////////////////////////////////////////////////////////// 318 | interface IAttributes { 319 | /** 320 | * this is necessary to be able to access the scoped attributes. it's not very elegant 321 | * because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way 322 | * this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 323 | */ 324 | [name: string]: any; 325 | 326 | /** 327 | * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-) to its normalized, camelCase form. 328 | * 329 | * Also there is special case for Moz prefix starting with upper case letter. 330 | * 331 | * For further information check out the guide on @see https://docs.angularjs.org/guide/directive#matching-directives 332 | */ 333 | $normalize(name: string): string; 334 | 335 | /** 336 | * Adds the CSS class value specified by the classVal parameter to the 337 | * element. If animations are enabled then an animation will be triggered 338 | * for the class addition. 339 | */ 340 | $addClass(classVal: string): void; 341 | 342 | /** 343 | * Removes the CSS class value specified by the classVal parameter from the 344 | * element. If animations are enabled then an animation will be triggered for 345 | * the class removal. 346 | */ 347 | $removeClass(classVal: string): void; 348 | 349 | /** 350 | * Adds and removes the appropriate CSS class values to the element based on the difference between 351 | * the new and old CSS class values (specified as newClasses and oldClasses). 352 | */ 353 | $updateClass(newClasses: string, oldClasses: string): void; 354 | 355 | /** 356 | * Set DOM element attribute value. 357 | */ 358 | $set(key: string, value: any): void; 359 | 360 | /** 361 | * Observes an interpolated attribute. 362 | * The observer function will be invoked once during the next $digest 363 | * following compilation. The observer is then invoked whenever the 364 | * interpolated value changes. 365 | */ 366 | $observe(name: string, fn: (value?: T) => any): Function; 367 | 368 | /** 369 | * A map of DOM element attribute names to the normalized name. This is needed 370 | * to do reverse lookup from normalized name back to actual name. 371 | */ 372 | $attr: Object; 373 | } 374 | 375 | /** 376 | * form.FormController - type in module ng 377 | * see https://docs.angularjs.org/api/ng/type/form.FormController 378 | */ 379 | interface IFormController { 380 | 381 | /** 382 | * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272 383 | */ 384 | [name: string]: any; 385 | 386 | $pristine: boolean; 387 | $dirty: boolean; 388 | $valid: boolean; 389 | $invalid: boolean; 390 | $submitted: boolean; 391 | $error: any; 392 | $pending: any; 393 | $addControl(control: INgModelController): void; 394 | $removeControl(control: INgModelController): void; 395 | $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void; 396 | $setDirty(): void; 397 | $setPristine(): void; 398 | $commitViewValue(): void; 399 | $rollbackViewValue(): void; 400 | $setSubmitted(): void; 401 | $setUntouched(): void; 402 | } 403 | 404 | /////////////////////////////////////////////////////////////////////////// 405 | // NgModelController 406 | // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController 407 | /////////////////////////////////////////////////////////////////////////// 408 | interface INgModelController { 409 | $render(): void; 410 | $setValidity(validationErrorKey: string, isValid: boolean): void; 411 | // Documentation states viewValue and modelValue to be a string but other 412 | // types do work and it's common to use them. 413 | $setViewValue(value: any, trigger?: string): void; 414 | $setPristine(): void; 415 | $setDirty(): void; 416 | $validate(): void; 417 | $setTouched(): void; 418 | $setUntouched(): void; 419 | $rollbackViewValue(): void; 420 | $commitViewValue(): void; 421 | $isEmpty(value: any): boolean; 422 | 423 | $viewValue: any; 424 | 425 | $modelValue: any; 426 | 427 | $parsers: IModelParser[]; 428 | $formatters: IModelFormatter[]; 429 | $viewChangeListeners: IModelViewChangeListener[]; 430 | $error: any; 431 | $name: string; 432 | 433 | $touched: boolean; 434 | $untouched: boolean; 435 | 436 | $validators: IModelValidators; 437 | $asyncValidators: IAsyncModelValidators; 438 | 439 | $pending: any; 440 | $pristine: boolean; 441 | $dirty: boolean; 442 | $valid: boolean; 443 | $invalid: boolean; 444 | } 445 | 446 | //Allows tuning how model updates are done. 447 | //https://docs.angularjs.org/api/ng/directive/ngModelOptions 448 | interface INgModelOptions { 449 | updateOn?: string; 450 | debounce?: any; 451 | allowInvalid?: boolean; 452 | getterSetter?: boolean; 453 | timezone?: string; 454 | } 455 | 456 | interface IModelValidators { 457 | /** 458 | * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName 459 | */ 460 | [index: string]: (modelValue: any, viewValue: any) => boolean; 461 | } 462 | 463 | interface IAsyncModelValidators { 464 | [index: string]: (modelValue: any, viewValue: any) => IPromise; 465 | } 466 | 467 | interface IModelParser { 468 | (value: any): any; 469 | } 470 | 471 | interface IModelFormatter { 472 | (value: any): any; 473 | } 474 | 475 | interface IModelViewChangeListener { 476 | (): void; 477 | } 478 | 479 | /** 480 | * $rootScope - $rootScopeProvider - service in module ng 481 | * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope 482 | */ 483 | interface IRootScopeService { 484 | [index: string]: any; 485 | 486 | $apply(): any; 487 | $apply(exp: string): any; 488 | $apply(exp: (scope: IScope) => any): any; 489 | 490 | $applyAsync(): any; 491 | $applyAsync(exp: string): any; 492 | $applyAsync(exp: (scope: IScope) => any): any; 493 | 494 | /** 495 | * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. 496 | * 497 | * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. 498 | * 499 | * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. 500 | * 501 | * @param name Event name to broadcast. 502 | * @param args Optional one or more arguments which will be passed onto the event listeners. 503 | */ 504 | $broadcast(name: string, ...args: any[]): IAngularEvent; 505 | $destroy(): void; 506 | $digest(): void; 507 | /** 508 | * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. 509 | * 510 | * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. 511 | * 512 | * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. 513 | * 514 | * @param name Event name to emit. 515 | * @param args Optional one or more arguments which will be passed onto the event listeners. 516 | */ 517 | $emit(name: string, ...args: any[]): IAngularEvent; 518 | 519 | $eval(): any; 520 | $eval(expression: string, locals?: Object): any; 521 | $eval(expression: (scope: IScope) => any, locals?: Object): any; 522 | 523 | $evalAsync(): void; 524 | $evalAsync(expression: string): void; 525 | $evalAsync(expression: (scope: IScope) => any): void; 526 | 527 | // Defaults to false by the implementation checking strategy 528 | $new(isolate?: boolean, parent?: IScope): IScope; 529 | 530 | /** 531 | * Listens on events of a given type. See $emit for discussion of event life cycle. 532 | * 533 | * The event listener function format is: function(event, args...). 534 | * 535 | * @param name Event name to listen on. 536 | * @param listener Function to call when the event is emitted. 537 | */ 538 | $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): () => void; 539 | 540 | $watch(watchExpression: string, listener?: string, objectEquality?: boolean): () => void; 541 | $watch(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void; 542 | $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): () => void; 543 | $watch(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): () => void; 544 | 545 | $watchCollection(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; 546 | $watchCollection(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void; 547 | 548 | $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; 549 | $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void; 550 | 551 | $parent: IScope; 552 | $root: IRootScopeService; 553 | $id: number; 554 | 555 | // Hidden members 556 | $$isolateBindings: any; 557 | $$phase: any; 558 | } 559 | 560 | interface IScope extends IRootScopeService { } 561 | 562 | /** 563 | * $scope for ngRepeat directive. 564 | * see https://docs.angularjs.org/api/ng/directive/ngRepeat 565 | */ 566 | interface IRepeatScope extends IScope { 567 | 568 | /** 569 | * iterator offset of the repeated element (0..length-1). 570 | */ 571 | $index: number; 572 | 573 | /** 574 | * true if the repeated element is first in the iterator. 575 | */ 576 | $first: boolean; 577 | 578 | /** 579 | * true if the repeated element is between the first and last in the iterator. 580 | */ 581 | $middle: boolean; 582 | 583 | /** 584 | * true if the repeated element is last in the iterator. 585 | */ 586 | $last: boolean; 587 | 588 | /** 589 | * true if the iterator position $index is even (otherwise false). 590 | */ 591 | $even: boolean; 592 | 593 | /** 594 | * true if the iterator position $index is odd (otherwise false). 595 | */ 596 | $odd: boolean; 597 | 598 | } 599 | 600 | interface IAngularEvent { 601 | /** 602 | * the scope on which the event was $emit-ed or $broadcast-ed. 603 | */ 604 | targetScope: IScope; 605 | /** 606 | * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null. 607 | */ 608 | currentScope: IScope; 609 | /** 610 | * name of the event. 611 | */ 612 | name: string; 613 | /** 614 | * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed). 615 | */ 616 | stopPropagation?: Function; 617 | /** 618 | * calling preventDefault sets defaultPrevented flag to true. 619 | */ 620 | preventDefault: Function; 621 | /** 622 | * true if preventDefault was called. 623 | */ 624 | defaultPrevented: boolean; 625 | } 626 | 627 | /////////////////////////////////////////////////////////////////////////// 628 | // WindowService 629 | // see http://docs.angularjs.org/api/ng.$window 630 | /////////////////////////////////////////////////////////////////////////// 631 | interface IWindowService extends Window { 632 | [key: string]: any; 633 | } 634 | 635 | /////////////////////////////////////////////////////////////////////////// 636 | // TimeoutService 637 | // see http://docs.angularjs.org/api/ng.$timeout 638 | /////////////////////////////////////////////////////////////////////////// 639 | interface ITimeoutService { 640 | (delay?: number, invokeApply?: boolean): IPromise; 641 | (fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise; 642 | cancel(promise?: IPromise): boolean; 643 | } 644 | 645 | /////////////////////////////////////////////////////////////////////////// 646 | // IntervalService 647 | // see http://docs.angularjs.org/api/ng.$interval 648 | /////////////////////////////////////////////////////////////////////////// 649 | interface IIntervalService { 650 | (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise; 651 | cancel(promise: IPromise): boolean; 652 | } 653 | 654 | /** 655 | * $filter - $filterProvider - service in module ng 656 | * 657 | * Filters are used for formatting data displayed to the user. 658 | * 659 | * see https://docs.angularjs.org/api/ng/service/$filter 660 | */ 661 | interface IFilterService { 662 | (name: 'filter'): IFilterFilter; 663 | (name: 'currency'): IFilterCurrency; 664 | (name: 'number'): IFilterNumber; 665 | (name: 'date'): IFilterDate; 666 | (name: 'json'): IFilterJson; 667 | (name: 'lowercase'): IFilterLowercase; 668 | (name: 'uppercase'): IFilterUppercase; 669 | (name: 'limitTo'): IFilterLimitTo; 670 | (name: 'orderBy'): IFilterOrderBy; 671 | /** 672 | * Usage: 673 | * $filter(name); 674 | * 675 | * @param name Name of the filter function to retrieve 676 | */ 677 | (name: string): T; 678 | } 679 | 680 | interface IFilterFilter { 681 | (array: T[], expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc, comparator?: IFilterFilterComparatorFunc|boolean): T[]; 682 | } 683 | 684 | interface IFilterFilterPatternObject { 685 | [name: string]: any; 686 | } 687 | 688 | interface IFilterFilterPredicateFunc { 689 | (value: T, index: number, array: T[]): boolean; 690 | } 691 | 692 | interface IFilterFilterComparatorFunc { 693 | (actual: T, expected: T): boolean; 694 | } 695 | 696 | interface IFilterCurrency { 697 | /** 698 | * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. 699 | * @param amount Input to filter. 700 | * @param symbol Currency symbol or identifier to be displayed. 701 | * @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale 702 | * @return Formatted number 703 | */ 704 | (amount: number, symbol?: string, fractionSize?: number): string; 705 | } 706 | 707 | interface IFilterNumber { 708 | /** 709 | * Formats a number as text. 710 | * @param number Number to format. 711 | * @param fractionSize Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3. 712 | * @return Number rounded to decimalPlaces and places a “,” after each third digit. 713 | */ 714 | (value: number|string, fractionSize?: number|string): string; 715 | } 716 | 717 | interface IFilterDate { 718 | /** 719 | * Formats date to a string based on the requested format. 720 | * 721 | * @param date Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone. 722 | * @param format Formatting rules (see Description). If not specified, mediumDate is used. 723 | * @param timezone Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. 724 | * @return Formatted string or the input if input is not recognized as date/millis. 725 | */ 726 | (date: Date | number | string, format?: string, timezone?: string): string; 727 | } 728 | 729 | interface IFilterJson { 730 | /** 731 | * Allows you to convert a JavaScript object into JSON string. 732 | * @param object Any JavaScript object (including arrays and primitive types) to filter. 733 | * @param spacing The number of spaces to use per indentation, defaults to 2. 734 | * @return JSON string. 735 | */ 736 | (object: any, spacing?: number): string; 737 | } 738 | 739 | interface IFilterLowercase { 740 | /** 741 | * Converts string to lowercase. 742 | */ 743 | (value: string): string; 744 | } 745 | 746 | interface IFilterUppercase { 747 | /** 748 | * Converts string to uppercase. 749 | */ 750 | (value: string): string; 751 | } 752 | 753 | interface IFilterLimitTo { 754 | /** 755 | * Creates a new array containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit. 756 | * @param input Source array to be limited. 757 | * @param limit The length of the returned array. If the limit number is positive, limit number of items from the beginning of the source array/string are copied. If the number is negative, limit number of items from the end of the source array are copied. The limit will be trimmed if it exceeds array.length. If limit is undefined, the input will be returned unchanged. 758 | * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. 759 | * @return A new sub-array of length limit or less if input array had less than limit elements. 760 | */ 761 | (input: T[], limit: string|number, begin?: string|number): T[]; 762 | /** 763 | * Creates a new string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string. 764 | * @param input Source string or number to be limited. 765 | * @param limit The length of the returned string. If the limit number is positive, limit number of items from the beginning of the source string are copied. If the number is negative, limit number of items from the end of the source string are copied. The limit will be trimmed if it exceeds input.length. If limit is undefined, the input will be returned unchanged. 766 | * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. 767 | * @return A new substring of length limit or less if input had less than limit elements. 768 | */ 769 | (input: string|number, limit: string|number, begin?: string|number): string; 770 | } 771 | 772 | interface IFilterOrderBy { 773 | /** 774 | * Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted as expected, make sure they are actually being saved as numbers and not strings. 775 | * @param array The array to sort. 776 | * @param expression A predicate to be used by the comparator to determine the order of elements. 777 | * @param reverse Reverse the order of the array. 778 | * @return Reverse the order of the array. 779 | */ 780 | (array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[]; 781 | } 782 | 783 | /** 784 | * $filterProvider - $filter - provider in module ng 785 | * 786 | * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. 787 | * 788 | * see https://docs.angularjs.org/api/ng/provider/$filterProvider 789 | */ 790 | interface IFilterProvider extends IServiceProvider { 791 | /** 792 | * register(name); 793 | * 794 | * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). 795 | */ 796 | register(name: string | {}): IServiceProvider; 797 | } 798 | 799 | /////////////////////////////////////////////////////////////////////////// 800 | // LocaleService 801 | // see http://docs.angularjs.org/api/ng.$locale 802 | /////////////////////////////////////////////////////////////////////////// 803 | interface ILocaleService { 804 | id: string; 805 | 806 | // These are not documented 807 | // Check angular's i18n files for exemples 808 | NUMBER_FORMATS: ILocaleNumberFormatDescriptor; 809 | DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; 810 | pluralCat: (num: any) => string; 811 | } 812 | 813 | interface ILocaleNumberFormatDescriptor { 814 | DECIMAL_SEP: string; 815 | GROUP_SEP: string; 816 | PATTERNS: ILocaleNumberPatternDescriptor[]; 817 | CURRENCY_SYM: string; 818 | } 819 | 820 | interface ILocaleNumberPatternDescriptor { 821 | minInt: number; 822 | minFrac: number; 823 | maxFrac: number; 824 | posPre: string; 825 | posSuf: string; 826 | negPre: string; 827 | negSuf: string; 828 | gSize: number; 829 | lgSize: number; 830 | } 831 | 832 | interface ILocaleDateTimeFormatDescriptor { 833 | MONTH: string[]; 834 | SHORTMONTH: string[]; 835 | DAY: string[]; 836 | SHORTDAY: string[]; 837 | AMPMS: string[]; 838 | medium: string; 839 | short: string; 840 | fullDate: string; 841 | longDate: string; 842 | mediumDate: string; 843 | shortDate: string; 844 | mediumTime: string; 845 | shortTime: string; 846 | } 847 | 848 | /////////////////////////////////////////////////////////////////////////// 849 | // LogService 850 | // see http://docs.angularjs.org/api/ng.$log 851 | // see http://docs.angularjs.org/api/ng.$logProvider 852 | /////////////////////////////////////////////////////////////////////////// 853 | interface ILogService { 854 | debug: ILogCall; 855 | error: ILogCall; 856 | info: ILogCall; 857 | log: ILogCall; 858 | warn: ILogCall; 859 | } 860 | 861 | interface ILogProvider extends IServiceProvider { 862 | debugEnabled(): boolean; 863 | debugEnabled(enabled: boolean): ILogProvider; 864 | } 865 | 866 | // We define this as separate interface so we can reopen it later for 867 | // the ngMock module. 868 | interface ILogCall { 869 | (...args: any[]): void; 870 | } 871 | 872 | /////////////////////////////////////////////////////////////////////////// 873 | // ParseService 874 | // see http://docs.angularjs.org/api/ng.$parse 875 | // see http://docs.angularjs.org/api/ng.$parseProvider 876 | /////////////////////////////////////////////////////////////////////////// 877 | interface IParseService { 878 | (expression: string): ICompiledExpression; 879 | } 880 | 881 | interface IParseProvider { 882 | logPromiseWarnings(): boolean; 883 | logPromiseWarnings(value: boolean): IParseProvider; 884 | 885 | unwrapPromises(): boolean; 886 | unwrapPromises(value: boolean): IParseProvider; 887 | } 888 | 889 | interface ICompiledExpression { 890 | (context: any, locals?: any): any; 891 | 892 | literal: boolean; 893 | constant: boolean; 894 | 895 | // If value is not provided, undefined is gonna be used since the implementation 896 | // does not check the parameter. Let's force a value for consistency. If consumer 897 | // whants to undefine it, pass the undefined value explicitly. 898 | assign(context: any, value: any): any; 899 | } 900 | 901 | /** 902 | * $location - $locationProvider - service in module ng 903 | * see https://docs.angularjs.org/api/ng/service/$location 904 | */ 905 | interface ILocationService { 906 | absUrl(): string; 907 | hash(): string; 908 | hash(newHash: string): ILocationService; 909 | host(): string; 910 | 911 | /** 912 | * Return path of current url 913 | */ 914 | path(): string; 915 | 916 | /** 917 | * Change path when called with parameter and return $location. 918 | * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing. 919 | * 920 | * @param path New path 921 | */ 922 | path(path: string): ILocationService; 923 | 924 | port(): number; 925 | protocol(): string; 926 | replace(): ILocationService; 927 | 928 | /** 929 | * Return search part (as object) of current url 930 | */ 931 | search(): any; 932 | 933 | /** 934 | * Change search part when called with parameter and return $location. 935 | * 936 | * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value. 937 | * 938 | * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url. 939 | */ 940 | search(search: any): ILocationService; 941 | 942 | /** 943 | * Change search part when called with parameter and return $location. 944 | * 945 | * @param search New search params 946 | * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. If paramValue is an array, it will override the property of the search component of $location specified via the first argument. If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. 947 | */ 948 | search(search: string, paramValue: string|number|string[]|boolean): ILocationService; 949 | 950 | state(): any; 951 | state(state: any): ILocationService; 952 | url(): string; 953 | url(url: string): ILocationService; 954 | } 955 | 956 | interface ILocationProvider extends IServiceProvider { 957 | hashPrefix(): string; 958 | hashPrefix(prefix: string): ILocationProvider; 959 | html5Mode(): boolean; 960 | 961 | // Documentation states that parameter is string, but 962 | // implementation tests it as boolean, which makes more sense 963 | // since this is a toggler 964 | html5Mode(active: boolean): ILocationProvider; 965 | html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider; 966 | } 967 | 968 | /////////////////////////////////////////////////////////////////////////// 969 | // DocumentService 970 | // see http://docs.angularjs.org/api/ng.$document 971 | /////////////////////////////////////////////////////////////////////////// 972 | interface IDocumentService extends IAugmentedJQuery {} 973 | 974 | /////////////////////////////////////////////////////////////////////////// 975 | // ExceptionHandlerService 976 | // see http://docs.angularjs.org/api/ng.$exceptionHandler 977 | /////////////////////////////////////////////////////////////////////////// 978 | interface IExceptionHandlerService { 979 | (exception: Error, cause?: string): void; 980 | } 981 | 982 | /////////////////////////////////////////////////////////////////////////// 983 | // RootElementService 984 | // see http://docs.angularjs.org/api/ng.$rootElement 985 | /////////////////////////////////////////////////////////////////////////// 986 | interface IRootElementService extends JQuery {} 987 | 988 | interface IQResolveReject { 989 | (): void; 990 | (value: T): void; 991 | } 992 | /** 993 | * $q - service in module ng 994 | * A promise/deferred implementation inspired by Kris Kowal's Q. 995 | * See http://docs.angularjs.org/api/ng/service/$q 996 | */ 997 | interface IQService { 998 | new (resolver: (resolve: IQResolveReject) => any): IPromise; 999 | new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; 1000 | (resolver: (resolve: IQResolveReject) => any): IPromise; 1001 | (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; 1002 | 1003 | /** 1004 | * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. 1005 | * 1006 | * Returns a single promise that will be resolved with an array of values, each value corresponding to the promise at the same index in the promises array. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. 1007 | * 1008 | * @param promises An array of promises. 1009 | */ 1010 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise, T9 | IPromise, T10 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; 1011 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise, T9 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; 1012 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>; 1013 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7]>; 1014 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6]>; 1015 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise]): IPromise<[T1, T2, T3, T4, T5]>; 1016 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise ]): IPromise<[T1, T2, T3, T4]>; 1017 | all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise]): IPromise<[T1, T2, T3]>; 1018 | all(values: [T1 | IPromise, T2 | IPromise]): IPromise<[T1, T2]>; 1019 | all(promises: IPromise[]): IPromise; 1020 | /** 1021 | * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. 1022 | * 1023 | * Returns a single promise that will be resolved with a hash of values, each value corresponding to the promise at the same key in the promises hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. 1024 | * 1025 | * @param promises A hash of promises. 1026 | */ 1027 | all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any; }>; 1028 | all(promises: { [id: string]: IPromise; }): IPromise; 1029 | /** 1030 | * Creates a Deferred object which represents a task which will finish in the future. 1031 | */ 1032 | defer(): IDeferred; 1033 | /** 1034 | * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. 1035 | * 1036 | * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. 1037 | * 1038 | * @param reason Constant, message, exception or an object representing the rejection reason. 1039 | */ 1040 | reject(reason?: any): IPromise; 1041 | /** 1042 | * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. 1043 | * 1044 | * @param value Value or a promise 1045 | */ 1046 | resolve(value: IPromise|T): IPromise; 1047 | /** 1048 | * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. 1049 | */ 1050 | resolve(): IPromise; 1051 | /** 1052 | * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. 1053 | * 1054 | * @param value Value or a promise 1055 | */ 1056 | when(value: IPromise|T): IPromise; 1057 | /** 1058 | * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. 1059 | */ 1060 | when(): IPromise; 1061 | } 1062 | 1063 | interface IPromise { 1064 | /** 1065 | * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. 1066 | * The successCallBack may return IPromise for when a $q.reject() needs to be returned 1067 | * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. 1068 | */ 1069 | then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; 1070 | 1071 | /** 1072 | * Shorthand for promise.then(null, errorCallback) 1073 | */ 1074 | catch(onRejected: (reason: any) => IPromise|TResult): IPromise; 1075 | 1076 | /** 1077 | * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. 1078 | * 1079 | * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. 1080 | */ 1081 | finally(finallyCallback: () => any): IPromise; 1082 | } 1083 | 1084 | interface IDeferred { 1085 | resolve(value?: T|IPromise): void; 1086 | reject(reason?: any): void; 1087 | notify(state?: any): void; 1088 | promise: IPromise; 1089 | } 1090 | 1091 | /////////////////////////////////////////////////////////////////////////// 1092 | // AnchorScrollService 1093 | // see http://docs.angularjs.org/api/ng.$anchorScroll 1094 | /////////////////////////////////////////////////////////////////////////// 1095 | interface IAnchorScrollService { 1096 | (): void; 1097 | (hash: string): void; 1098 | yOffset: any; 1099 | } 1100 | 1101 | interface IAnchorScrollProvider extends IServiceProvider { 1102 | disableAutoScrolling(): void; 1103 | } 1104 | 1105 | /** 1106 | * $cacheFactory - service in module ng 1107 | * 1108 | * Factory that constructs Cache objects and gives access to them. 1109 | * 1110 | * see https://docs.angularjs.org/api/ng/service/$cacheFactory 1111 | */ 1112 | interface ICacheFactoryService { 1113 | /** 1114 | * Factory that constructs Cache objects and gives access to them. 1115 | * 1116 | * @param cacheId Name or id of the newly created cache. 1117 | * @param optionsMap Options object that specifies the cache behavior. Properties: 1118 | * 1119 | * capacity — turns the cache into LRU cache. 1120 | */ 1121 | (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; 1122 | 1123 | /** 1124 | * Get information about all the caches that have been created. 1125 | * @returns key-value map of cacheId to the result of calling cache#info 1126 | */ 1127 | info(): any; 1128 | 1129 | /** 1130 | * Get access to a cache object by the cacheId used when it was created. 1131 | * 1132 | * @param cacheId Name or id of a cache to access. 1133 | */ 1134 | get(cacheId: string): ICacheObject; 1135 | } 1136 | 1137 | /** 1138 | * $cacheFactory.Cache - type in module ng 1139 | * 1140 | * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. 1141 | * 1142 | * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache 1143 | */ 1144 | interface ICacheObject { 1145 | /** 1146 | * Retrieve information regarding a particular Cache. 1147 | */ 1148 | info(): { 1149 | /** 1150 | * the id of the cache instance 1151 | */ 1152 | id: string; 1153 | 1154 | /** 1155 | * the number of entries kept in the cache instance 1156 | */ 1157 | size: number; 1158 | 1159 | //...: any additional properties from the options object when creating the cache. 1160 | }; 1161 | 1162 | /** 1163 | * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. 1164 | * 1165 | * It will not insert undefined values into the cache. 1166 | * 1167 | * @param key the key under which the cached data is stored. 1168 | * @param value the value to store alongside the key. If it is undefined, the key will not be stored. 1169 | */ 1170 | put(key: string, value?: T): T; 1171 | 1172 | /** 1173 | * Retrieves named data stored in the Cache object. 1174 | * 1175 | * @param key the key of the data to be retrieved 1176 | */ 1177 | get(key: string): T; 1178 | 1179 | /** 1180 | * Removes an entry from the Cache object. 1181 | * 1182 | * @param key the key of the entry to be removed 1183 | */ 1184 | remove(key: string): void; 1185 | 1186 | /** 1187 | * Clears the cache object of any entries. 1188 | */ 1189 | removeAll(): void; 1190 | 1191 | /** 1192 | * Destroys the Cache object entirely, removing it from the $cacheFactory set. 1193 | */ 1194 | destroy(): void; 1195 | } 1196 | 1197 | /////////////////////////////////////////////////////////////////////////// 1198 | // CompileService 1199 | // see http://docs.angularjs.org/api/ng.$compile 1200 | // see http://docs.angularjs.org/api/ng.$compileProvider 1201 | /////////////////////////////////////////////////////////////////////////// 1202 | interface ICompileService { 1203 | (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; 1204 | (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; 1205 | (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; 1206 | } 1207 | 1208 | interface ICompileProvider extends IServiceProvider { 1209 | directive(name: string, directiveFactory: Function): ICompileProvider; 1210 | directive(directivesMap: Object, directiveFactory: Function): ICompileProvider; 1211 | directive(name: string, inlineAnnotatedFunction: any[]): ICompileProvider; 1212 | directive(directivesMap: Object, inlineAnnotatedFunction: any[]): ICompileProvider; 1213 | 1214 | // Undocumented, but it is there... 1215 | directive(directivesMap: any): ICompileProvider; 1216 | 1217 | component(name: string, options: IComponentOptions): ICompileProvider; 1218 | 1219 | aHrefSanitizationWhitelist(): RegExp; 1220 | aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; 1221 | 1222 | imgSrcSanitizationWhitelist(): RegExp; 1223 | imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; 1224 | 1225 | debugInfoEnabled(enabled?: boolean): any; 1226 | } 1227 | 1228 | interface ICloneAttachFunction { 1229 | // Let's hint but not force cloneAttachFn's signature 1230 | (clonedElement?: JQuery, scope?: IScope): any; 1231 | } 1232 | 1233 | // This corresponds to the "publicLinkFn" returned by $compile. 1234 | interface ITemplateLinkingFunction { 1235 | (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; 1236 | } 1237 | 1238 | // This corresponds to $transclude (and also the transclude function passed to link). 1239 | interface ITranscludeFunction { 1240 | // If the scope is provided, then the cloneAttachFn must be as well. 1241 | (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; 1242 | // If one argument is provided, then it's assumed to be the cloneAttachFn. 1243 | (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; 1244 | } 1245 | 1246 | /////////////////////////////////////////////////////////////////////////// 1247 | // ControllerService 1248 | // see http://docs.angularjs.org/api/ng.$controller 1249 | // see http://docs.angularjs.org/api/ng.$controllerProvider 1250 | /////////////////////////////////////////////////////////////////////////// 1251 | interface IControllerService { 1252 | // Although the documentation doesn't state this, locals are optional 1253 | (controllerConstructor: new (...args: any[]) => T, locals?: any, later?: boolean, ident?: string): T; 1254 | (controllerConstructor: Function, locals?: any, later?: boolean, ident?: string): T; 1255 | (controllerName: string, locals?: any, later?: boolean, ident?: string): T; 1256 | } 1257 | 1258 | interface IControllerProvider extends IServiceProvider { 1259 | register(name: string, controllerConstructor: Function): void; 1260 | register(name: string, dependencyAnnotatedConstructor: any[]): void; 1261 | allowGlobals(): void; 1262 | } 1263 | 1264 | /** 1265 | * xhrFactory 1266 | * Replace or decorate this service to create your own custom XMLHttpRequest objects. 1267 | * see https://docs.angularjs.org/api/ng/service/$xhrFactory 1268 | */ 1269 | interface IXhrFactory { 1270 | (method: string, url: string): T; 1271 | } 1272 | 1273 | /** 1274 | * HttpService 1275 | * see http://docs.angularjs.org/api/ng/service/$http 1276 | */ 1277 | interface IHttpService { 1278 | /** 1279 | * Object describing the request to be made and how it should be processed. 1280 | */ 1281 | (config: IRequestConfig): IHttpPromise; 1282 | 1283 | /** 1284 | * Shortcut method to perform GET request. 1285 | * 1286 | * @param url Relative or absolute URL specifying the destination of the request 1287 | * @param config Optional configuration object 1288 | */ 1289 | get(url: string, config?: IRequestShortcutConfig): IHttpPromise; 1290 | 1291 | /** 1292 | * Shortcut method to perform DELETE request. 1293 | * 1294 | * @param url Relative or absolute URL specifying the destination of the request 1295 | * @param config Optional configuration object 1296 | */ 1297 | delete(url: string, config?: IRequestShortcutConfig): IHttpPromise; 1298 | 1299 | /** 1300 | * Shortcut method to perform HEAD request. 1301 | * 1302 | * @param url Relative or absolute URL specifying the destination of the request 1303 | * @param config Optional configuration object 1304 | */ 1305 | head(url: string, config?: IRequestShortcutConfig): IHttpPromise; 1306 | 1307 | /** 1308 | * Shortcut method to perform JSONP request. 1309 | * 1310 | * @param url Relative or absolute URL specifying the destination of the request 1311 | * @param config Optional configuration object 1312 | */ 1313 | jsonp(url: string, config?: IRequestShortcutConfig): IHttpPromise; 1314 | 1315 | /** 1316 | * Shortcut method to perform POST request. 1317 | * 1318 | * @param url Relative or absolute URL specifying the destination of the request 1319 | * @param data Request content 1320 | * @param config Optional configuration object 1321 | */ 1322 | post(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; 1323 | 1324 | /** 1325 | * Shortcut method to perform PUT request. 1326 | * 1327 | * @param url Relative or absolute URL specifying the destination of the request 1328 | * @param data Request content 1329 | * @param config Optional configuration object 1330 | */ 1331 | put(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; 1332 | 1333 | /** 1334 | * Shortcut method to perform PATCH request. 1335 | * 1336 | * @param url Relative or absolute URL specifying the destination of the request 1337 | * @param data Request content 1338 | * @param config Optional configuration object 1339 | */ 1340 | patch(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; 1341 | 1342 | /** 1343 | * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. 1344 | */ 1345 | defaults: IHttpProviderDefaults; 1346 | 1347 | /** 1348 | * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. 1349 | */ 1350 | pendingRequests: IRequestConfig[]; 1351 | } 1352 | 1353 | /** 1354 | * Object describing the request to be made and how it should be processed. 1355 | * see http://docs.angularjs.org/api/ng/service/$http#usage 1356 | */ 1357 | interface IRequestShortcutConfig extends IHttpProviderDefaults { 1358 | /** 1359 | * {Object.} 1360 | * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. 1361 | */ 1362 | params?: any; 1363 | 1364 | /** 1365 | * {string|Object} 1366 | * Data to be sent as the request message data. 1367 | */ 1368 | data?: any; 1369 | 1370 | /** 1371 | * Timeout in milliseconds, or promise that should abort the request when resolved. 1372 | */ 1373 | timeout?: number|IPromise; 1374 | 1375 | /** 1376 | * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype 1377 | */ 1378 | responseType?: string; 1379 | } 1380 | 1381 | /** 1382 | * Object describing the request to be made and how it should be processed. 1383 | * see http://docs.angularjs.org/api/ng/service/$http#usage 1384 | */ 1385 | interface IRequestConfig extends IRequestShortcutConfig { 1386 | /** 1387 | * HTTP method (e.g. 'GET', 'POST', etc) 1388 | */ 1389 | method: string; 1390 | /** 1391 | * Absolute or relative URL of the resource that is being requested. 1392 | */ 1393 | url: string; 1394 | } 1395 | 1396 | interface IHttpHeadersGetter { 1397 | (): { [name: string]: string; }; 1398 | (headerName: string): string; 1399 | } 1400 | 1401 | interface IHttpPromiseCallback { 1402 | (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void; 1403 | } 1404 | 1405 | interface IHttpPromiseCallbackArg { 1406 | data?: T; 1407 | status?: number; 1408 | headers?: IHttpHeadersGetter; 1409 | config?: IRequestConfig; 1410 | statusText?: string; 1411 | } 1412 | 1413 | interface IHttpPromise extends IPromise> { 1414 | /** 1415 | * The $http legacy promise methods success and error have been deprecated. Use the standard then method instead. 1416 | * If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error. 1417 | * @deprecated 1418 | */ 1419 | success?(callback: IHttpPromiseCallback): IHttpPromise; 1420 | /** 1421 | * The $http legacy promise methods success and error have been deprecated. Use the standard then method instead. 1422 | * If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error. 1423 | * @deprecated 1424 | */ 1425 | error?(callback: IHttpPromiseCallback): IHttpPromise; 1426 | } 1427 | 1428 | // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228 1429 | interface IHttpRequestTransformer { 1430 | (data: any, headersGetter: IHttpHeadersGetter): any; 1431 | } 1432 | 1433 | // The definition of fields are the same as IHttpPromiseCallbackArg 1434 | interface IHttpResponseTransformer { 1435 | (data: any, headersGetter: IHttpHeadersGetter, status: number): any; 1436 | } 1437 | 1438 | type HttpHeaderType = {[requestType: string]:string|((config:IRequestConfig) => string)}; 1439 | 1440 | interface IHttpRequestConfigHeaders { 1441 | [requestType: string]: any; 1442 | common?: any; 1443 | get?: any; 1444 | post?: any; 1445 | put?: any; 1446 | patch?: any; 1447 | } 1448 | 1449 | /** 1450 | * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured 1451 | * via defaults and the docs do not say which. The following is based on the inspection of the source code. 1452 | * https://docs.angularjs.org/api/ng/service/$http#defaults 1453 | * https://docs.angularjs.org/api/ng/service/$http#usage 1454 | * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section 1455 | */ 1456 | interface IHttpProviderDefaults { 1457 | /** 1458 | * {boolean|Cache} 1459 | * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. 1460 | */ 1461 | cache?: any; 1462 | 1463 | /** 1464 | * Transform function or an array of such functions. The transform function takes the http request body and 1465 | * headers and returns its transformed (typically serialized) version. 1466 | * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses} 1467 | */ 1468 | transformRequest?: IHttpRequestTransformer |IHttpRequestTransformer[]; 1469 | 1470 | /** 1471 | * Transform function or an array of such functions. The transform function takes the http response body and 1472 | * headers and returns its transformed (typically deserialized) version. 1473 | */ 1474 | transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; 1475 | 1476 | /** 1477 | * Map of strings or functions which return strings representing HTTP headers to send to the server. If the 1478 | * return value of a function is null, the header will not be sent. 1479 | * The key of the map is the request verb in lower case. The "common" key applies to all requests. 1480 | * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers} 1481 | */ 1482 | headers?: IHttpRequestConfigHeaders; 1483 | 1484 | /** Name of HTTP header to populate with the XSRF token. */ 1485 | xsrfHeaderName?: string; 1486 | 1487 | /** Name of cookie containing the XSRF token. */ 1488 | xsrfCookieName?: string; 1489 | 1490 | /** 1491 | * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. 1492 | */ 1493 | withCredentials?: boolean; 1494 | 1495 | /** 1496 | * A function used to the prepare string representation of request parameters (specified as an object). If 1497 | * specified as string, it is interpreted as a function registered with the $injector. Defaults to 1498 | * $httpParamSerializer. 1499 | */ 1500 | paramSerializer?: string | ((obj: any) => string); 1501 | } 1502 | 1503 | interface IHttpInterceptor { 1504 | request?: (config: IRequestConfig) => IRequestConfig|IPromise; 1505 | requestError?: (rejection: any) => any; 1506 | response?: (response: IHttpPromiseCallbackArg) => IPromise>|IHttpPromiseCallbackArg; 1507 | responseError?: (rejection: any) => any; 1508 | } 1509 | 1510 | interface IHttpInterceptorFactory { 1511 | (...args: any[]): IHttpInterceptor; 1512 | } 1513 | 1514 | interface IHttpProvider extends IServiceProvider { 1515 | defaults: IHttpProviderDefaults; 1516 | 1517 | /** 1518 | * Register service factories (names or implementations) for interceptors which are called before and after 1519 | * each request. 1520 | */ 1521 | interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[]; 1522 | useApplyAsync(): boolean; 1523 | useApplyAsync(value: boolean): IHttpProvider; 1524 | 1525 | /** 1526 | * 1527 | * @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods. 1528 | * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. 1529 | * otherwise, returns the current configured value. 1530 | */ 1531 | useLegacyPromiseExtensions(value:boolean) : boolean | IHttpProvider; 1532 | } 1533 | 1534 | /////////////////////////////////////////////////////////////////////////// 1535 | // HttpBackendService 1536 | // see http://docs.angularjs.org/api/ng.$httpBackend 1537 | // You should never need to use this service directly. 1538 | /////////////////////////////////////////////////////////////////////////// 1539 | interface IHttpBackendService { 1540 | // XXX Perhaps define callback signature in the future 1541 | (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; 1542 | } 1543 | 1544 | /////////////////////////////////////////////////////////////////////////// 1545 | // InterpolateService 1546 | // see http://docs.angularjs.org/api/ng.$interpolate 1547 | // see http://docs.angularjs.org/api/ng.$interpolateProvider 1548 | /////////////////////////////////////////////////////////////////////////// 1549 | interface IInterpolateService { 1550 | (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction; 1551 | endSymbol(): string; 1552 | startSymbol(): string; 1553 | } 1554 | 1555 | interface IInterpolationFunction { 1556 | (context: any): string; 1557 | } 1558 | 1559 | interface IInterpolateProvider extends IServiceProvider { 1560 | startSymbol(): string; 1561 | startSymbol(value: string): IInterpolateProvider; 1562 | endSymbol(): string; 1563 | endSymbol(value: string): IInterpolateProvider; 1564 | } 1565 | 1566 | /////////////////////////////////////////////////////////////////////////// 1567 | // TemplateCacheService 1568 | // see http://docs.angularjs.org/api/ng.$templateCache 1569 | /////////////////////////////////////////////////////////////////////////// 1570 | interface ITemplateCacheService extends ICacheObject {} 1571 | 1572 | /////////////////////////////////////////////////////////////////////////// 1573 | // SCEService 1574 | // see http://docs.angularjs.org/api/ng.$sce 1575 | /////////////////////////////////////////////////////////////////////////// 1576 | interface ISCEService { 1577 | getTrusted(type: string, mayBeTrusted: any): any; 1578 | getTrustedCss(value: any): any; 1579 | getTrustedHtml(value: any): any; 1580 | getTrustedJs(value: any): any; 1581 | getTrustedResourceUrl(value: any): any; 1582 | getTrustedUrl(value: any): any; 1583 | parse(type: string, expression: string): (context: any, locals: any) => any; 1584 | parseAsCss(expression: string): (context: any, locals: any) => any; 1585 | parseAsHtml(expression: string): (context: any, locals: any) => any; 1586 | parseAsJs(expression: string): (context: any, locals: any) => any; 1587 | parseAsResourceUrl(expression: string): (context: any, locals: any) => any; 1588 | parseAsUrl(expression: string): (context: any, locals: any) => any; 1589 | trustAs(type: string, value: any): any; 1590 | trustAsHtml(value: any): any; 1591 | trustAsJs(value: any): any; 1592 | trustAsResourceUrl(value: any): any; 1593 | trustAsUrl(value: any): any; 1594 | isEnabled(): boolean; 1595 | } 1596 | 1597 | /////////////////////////////////////////////////////////////////////////// 1598 | // SCEProvider 1599 | // see http://docs.angularjs.org/api/ng.$sceProvider 1600 | /////////////////////////////////////////////////////////////////////////// 1601 | interface ISCEProvider extends IServiceProvider { 1602 | enabled(value: boolean): void; 1603 | } 1604 | 1605 | /////////////////////////////////////////////////////////////////////////// 1606 | // SCEDelegateService 1607 | // see http://docs.angularjs.org/api/ng.$sceDelegate 1608 | /////////////////////////////////////////////////////////////////////////// 1609 | interface ISCEDelegateService { 1610 | getTrusted(type: string, mayBeTrusted: any): any; 1611 | trustAs(type: string, value: any): any; 1612 | valueOf(value: any): any; 1613 | } 1614 | 1615 | 1616 | /////////////////////////////////////////////////////////////////////////// 1617 | // SCEDelegateProvider 1618 | // see http://docs.angularjs.org/api/ng.$sceDelegateProvider 1619 | /////////////////////////////////////////////////////////////////////////// 1620 | interface ISCEDelegateProvider extends IServiceProvider { 1621 | resourceUrlBlacklist(blacklist: any[]): void; 1622 | resourceUrlWhitelist(whitelist: any[]): void; 1623 | resourceUrlBlacklist(): any[]; 1624 | resourceUrlWhitelist(): any[]; 1625 | } 1626 | 1627 | /** 1628 | * $templateRequest service 1629 | * see http://docs.angularjs.org/api/ng/service/$templateRequest 1630 | */ 1631 | interface ITemplateRequestService { 1632 | /** 1633 | * Downloads a template using $http and, upon success, stores the 1634 | * contents inside of $templateCache. 1635 | * 1636 | * If the HTTP request fails or the response data of the HTTP request is 1637 | * empty then a $compile error will be thrown (unless 1638 | * {ignoreRequestError} is set to true). 1639 | * 1640 | * @param tpl The template URL. 1641 | * @param ignoreRequestError Whether or not to ignore the exception 1642 | * when the request fails or the template is 1643 | * empty. 1644 | * 1645 | * @return A promise whose value is the template content. 1646 | */ 1647 | (tpl: string, ignoreRequestError?: boolean): IPromise; 1648 | /** 1649 | * total amount of pending template requests being downloaded. 1650 | * @type {number} 1651 | */ 1652 | totalPendingRequests: number; 1653 | } 1654 | 1655 | /////////////////////////////////////////////////////////////////////////// 1656 | // Component 1657 | // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html 1658 | // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ 1659 | /////////////////////////////////////////////////////////////////////////// 1660 | /** 1661 | * Runtime representation a type that a Component or other object is instances of. 1662 | * 1663 | * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by 1664 | * the `MyCustomComponent` constructor function. 1665 | */ 1666 | interface Type extends Function { 1667 | } 1668 | 1669 | /** 1670 | * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. 1671 | * 1672 | * Supported keys: 1673 | * - `path` or `aux` (requires exactly one of these) 1674 | * - `component`, `loader`, `redirectTo` (requires exactly one of these) 1675 | * - `name` or `as` (optional) (requires exactly one of these) 1676 | * - `data` (optional) 1677 | * 1678 | * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. 1679 | */ 1680 | interface RouteDefinition { 1681 | path?: string; 1682 | aux?: string; 1683 | component?: Type | ComponentDefinition | string; 1684 | loader?: Function; 1685 | redirectTo?: any[]; 1686 | as?: string; 1687 | name?: string; 1688 | data?: any; 1689 | useAsDefault?: boolean; 1690 | } 1691 | 1692 | /** 1693 | * Represents either a component type (`type` is `component`) or a loader function 1694 | * (`type` is `loader`). 1695 | * 1696 | * See also {@link RouteDefinition}. 1697 | */ 1698 | interface ComponentDefinition { 1699 | type: string; 1700 | loader?: Function; 1701 | component?: Type; 1702 | } 1703 | 1704 | /** 1705 | * Component definition object (a simplified directive definition object) 1706 | */ 1707 | interface IComponentOptions { 1708 | /** 1709 | * Controller constructor function that should be associated with newly created scope or the name of a registered 1710 | * controller if passed as a string. Empty function by default. 1711 | * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection) 1712 | */ 1713 | controller?: string | Function | (string | Function)[]; 1714 | /** 1715 | * An identifier name for a reference to the controller. If present, the controller will be published to scope under 1716 | * the controllerAs name. If not present, this will default to be the same as the component name. 1717 | * @default "$ctrl" 1718 | */ 1719 | controllerAs?: string; 1720 | /** 1721 | * html template as a string or a function that returns an html template as a string which should be used as the 1722 | * contents of this component. Empty string by default. 1723 | * If template is a function, then it is injected with the following locals: 1724 | * $element - Current element 1725 | * $attrs - Current attributes object for the element 1726 | * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection) 1727 | */ 1728 | template?: string | Function | (string | Function)[]; 1729 | /** 1730 | * path or function that returns a path to an html template that should be used as the contents of this component. 1731 | * If templateUrl is a function, then it is injected with the following locals: 1732 | * $element - Current element 1733 | * $attrs - Current attributes object for the element 1734 | * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection) 1735 | */ 1736 | templateUrl?: string | Function | (string | Function)[]; 1737 | /** 1738 | * Define DOM attribute binding to component properties. Component properties are always bound to the component 1739 | * controller and not to the scope. 1740 | */ 1741 | bindings?: {[binding: string]: string}; 1742 | /** 1743 | * Whether transclusion is enabled. Enabled by default. 1744 | */ 1745 | transclude?: boolean | string | {[slot: string]: string}; 1746 | require?: string | string[] | {[controller: string]: string}; 1747 | } 1748 | 1749 | interface IComponentTemplateFn { 1750 | ( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string; 1751 | } 1752 | 1753 | /////////////////////////////////////////////////////////////////////////// 1754 | // Directive 1755 | // see http://docs.angularjs.org/api/ng.$compileProvider#directive 1756 | // and http://docs.angularjs.org/guide/directive 1757 | /////////////////////////////////////////////////////////////////////////// 1758 | 1759 | interface IDirectiveFactory { 1760 | (...args: any[]): IDirective; 1761 | } 1762 | 1763 | interface IDirectiveLinkFn { 1764 | ( 1765 | scope: IScope, 1766 | instanceElement: IAugmentedJQuery, 1767 | instanceAttributes: IAttributes, 1768 | controller: {}, 1769 | transclude: ITranscludeFunction 1770 | ): void; 1771 | } 1772 | 1773 | interface IDirectivePrePost { 1774 | pre?: IDirectiveLinkFn; 1775 | post?: IDirectiveLinkFn; 1776 | } 1777 | 1778 | interface IDirectiveCompileFn { 1779 | ( 1780 | templateElement: IAugmentedJQuery, 1781 | templateAttributes: IAttributes, 1782 | /** 1783 | * @deprecated 1784 | * Note: The transclude function that is passed to the compile function is deprecated, 1785 | * as it e.g. does not know about the right outer scope. Please use the transclude function 1786 | * that is passed to the link function instead. 1787 | */ 1788 | transclude: ITranscludeFunction 1789 | ): IDirectivePrePost; 1790 | } 1791 | 1792 | interface IDirective { 1793 | compile?: IDirectiveCompileFn; 1794 | controller?: any; 1795 | controllerAs?: string; 1796 | /** 1797 | * @deprecated 1798 | * Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before 1799 | * the controller constructor is called, this use is now deprecated. Please place initialization code that 1800 | * relies upon bindings inside a $onInit method on the controller, instead. 1801 | */ 1802 | bindToController?: boolean | Object; 1803 | link?: IDirectiveLinkFn | IDirectivePrePost; 1804 | multiElement?: boolean; 1805 | name?: string; 1806 | priority?: number; 1807 | /** 1808 | * @deprecated 1809 | */ 1810 | replace?: boolean; 1811 | require?: string | string[] | {[controller: string]: string}; 1812 | restrict?: string; 1813 | scope?: boolean | Object; 1814 | template?: string | Function; 1815 | templateNamespace?: string; 1816 | templateUrl?: string | Function; 1817 | terminal?: boolean; 1818 | transclude?: boolean | string | {[slot: string]: string}; 1819 | } 1820 | 1821 | /** 1822 | * angular.element 1823 | * when calling angular.element, angular returns a jQuery object, 1824 | * augmented with additional methods like e.g. scope. 1825 | * see: http://docs.angularjs.org/api/angular.element 1826 | */ 1827 | interface IAugmentedJQueryStatic extends JQueryStatic { 1828 | (selector: string, context?: any): IAugmentedJQuery; 1829 | (element: Element): IAugmentedJQuery; 1830 | (object: {}): IAugmentedJQuery; 1831 | (elementArray: Element[]): IAugmentedJQuery; 1832 | (object: JQuery): IAugmentedJQuery; 1833 | (func: Function): IAugmentedJQuery; 1834 | (array: any[]): IAugmentedJQuery; 1835 | (): IAugmentedJQuery; 1836 | } 1837 | 1838 | interface IAugmentedJQuery extends JQuery { 1839 | // TODO: events, how to define? 1840 | //$destroy 1841 | 1842 | find(selector: string): IAugmentedJQuery; 1843 | find(element: any): IAugmentedJQuery; 1844 | find(obj: JQuery): IAugmentedJQuery; 1845 | controller(): any; 1846 | controller(name: string): any; 1847 | injector(): any; 1848 | scope(): IScope; 1849 | 1850 | /** 1851 | * Overload for custom scope interfaces 1852 | */ 1853 | scope(): T; 1854 | isolateScope(): IScope; 1855 | 1856 | inheritedData(key: string, value: any): JQuery; 1857 | inheritedData(obj: { [key: string]: any; }): JQuery; 1858 | inheritedData(key?: string): any; 1859 | } 1860 | 1861 | /////////////////////////////////////////////////////////////////////////// 1862 | // AUTO module (angular.js) 1863 | /////////////////////////////////////////////////////////////////////////// 1864 | export module auto { 1865 | 1866 | /////////////////////////////////////////////////////////////////////// 1867 | // InjectorService 1868 | // see http://docs.angularjs.org/api/AUTO.$injector 1869 | /////////////////////////////////////////////////////////////////////// 1870 | interface IInjectorService { 1871 | annotate(fn: Function, strictDi?: boolean): string[]; 1872 | annotate(inlineAnnotatedFunction: any[]): string[]; 1873 | get(name: string, caller?: string): T; 1874 | has(name: string): boolean; 1875 | instantiate(typeConstructor: Function, locals?: any): T; 1876 | invoke(inlineAnnotatedFunction: any[]): any; 1877 | invoke(func: Function, context?: any, locals?: any): any; 1878 | strictDi: boolean; 1879 | } 1880 | 1881 | /////////////////////////////////////////////////////////////////////// 1882 | // ProvideService 1883 | // see http://docs.angularjs.org/api/AUTO.$provide 1884 | /////////////////////////////////////////////////////////////////////// 1885 | interface IProvideService { 1886 | // Documentation says it returns the registered instance, but actual 1887 | // implementation does not return anything. 1888 | // constant(name: string, value: any): any; 1889 | /** 1890 | * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. 1891 | * 1892 | * @param name The name of the constant. 1893 | * @param value The constant value. 1894 | */ 1895 | constant(name: string, value: any): void; 1896 | 1897 | /** 1898 | * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. 1899 | * 1900 | * @param name The name of the service to decorate. 1901 | * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: 1902 | * 1903 | * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. 1904 | */ 1905 | decorator(name: string, decorator: Function): void; 1906 | /** 1907 | * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. 1908 | * 1909 | * @param name The name of the service to decorate. 1910 | * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: 1911 | * 1912 | * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. 1913 | */ 1914 | decorator(name: string, inlineAnnotatedFunction: any[]): void; 1915 | factory(name: string, serviceFactoryFunction: Function): IServiceProvider; 1916 | factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; 1917 | provider(name: string, provider: IServiceProvider): IServiceProvider; 1918 | provider(name: string, serviceProviderConstructor: Function): IServiceProvider; 1919 | service(name: string, constructor: Function): IServiceProvider; 1920 | service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; 1921 | value(name: string, value: any): IServiceProvider; 1922 | } 1923 | 1924 | } 1925 | 1926 | /** 1927 | * $http params serializer that converts objects to strings 1928 | * see https://docs.angularjs.org/api/ng/service/$httpParamSerializer 1929 | */ 1930 | interface IHttpParamSerializer { 1931 | (obj: Object): string; 1932 | } 1933 | } --------------------------------------------------------------------------------