I'm using Typescript with AngularJS.
I have a problem with modals using typed definition of jQuery library.
I get the following error: 'error TS2339: Property 'modal' does not exist on type 'JQuery'.'
Version: jQuery library, version 1.10.x / 2.0.x
Definitions: https://github.com/borisyankov/DefinitelyTyped
Code
$scope.delete = function (id) {
Photo.get({id: id}, function(result) {
$scope.photo = result;
$('#deletePhotoConfirmation').modal('show');// error line
});
};
I'm referencing to jquery.d.ts
in angular.d.ts
<reference path="../jquery/jquery.d.ts" />
and my global vendor reference file looks like:
<reference path='../vendor/types/angular/angular.d.ts' />
<reference path='../vendor/types/angular/angular-mocks.d.ts' />
<reference path='../vendor/types/jasmine/jasmine.d.ts' />
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…