나는이 서비스를 가지고 :Typescript를 사용하여 AngularJS 서비스를 변경하려면 어떻게해야합니까?
app.factory('utilityService', [
'$http',
'$angularCacheFactory',
utilityService
]);
function utilityService(
$http,
$angularCacheFactory
) {
var factory = {};
factory.rowClicked = function ($index, collection) {
var row = collection[$index];
if (row.current) {
row.current = false;
return null;
} else {
collection.forEach(function (object) {
object.current = false;
});
row.current = true;
return $index;
}
};
factory.isArrayAndNotEmpty = function (theArray) {
var rc = typeof theArray !== 'undefined' && theArray.length > 0;
return rc;
};
return factory;
}
타이프 라이터는이 rowClicked (내가 공간을 절약하기 위해 여기에 표시되지 않은 다른 모든 기능)에 올 때까지 괜찮 모든 것을 인식하는 것이 나타납니다.
factory.rowClicked
The property rowClicked does not exist on value of type '{}'
왜 수업을 사용하지 않으시겠습니까? https://www.youtube.com/watch?v=Yis8m3BdnEM&hd=1 – basarat