1
我使用AngularJS和打字稿,並得到ngSmoothScroll服務如下ngSmoothScroll從打字稿
/// <reference path="../includes.ts" />
declare function smoothScroll(element, options);
module ScrollerSrvc{
export interface IScrollerService{
TopScroll(): any;
}
export class ScrollerService implements IScrollerService{
static $inject = ['smoothScroll'];
TopScroll() {
var element = document.getElementById('scroller');
var options = {
duration: 500,
easing: 'easeOutQuad',
offset: 0,
callbackBefore: function(element) {
},
callbackAfter: function(element) {
}
}
smoothScroll(element, options);
}
}
function factory(): IScrollerService {
return new ScrollerService();
}
angular.module('ScrollerSrvc', []).factory('ScrollerSrvc', factory);
}
,當我從我的控制器調用TopScroll是說沒有定義smoothScroll。
任何想法,爲什麼可能是這種情況?