반응형
TypeError: $scope.apply는 함수가 아닙니다.
연락처 목록을 검색한 후 렌더링하려고 합니다.rdflib.js
. 정상적으로 로딩되어 스코프 내 리스트에 저장되고 있습니다.
그러나 $scope가 업데이트되지 않아 렌더링할 수 없습니다.콜을 하고 있는 것 같습니다.$scope.apply()
잘못된 장소에.이 에러는 angular 외부라고 부르기 때문에 발생합니다만, 일부러 angular 콘텍스트 외부에 있는 함수 내부에서 호출하고 있습니다(nowOrWhenFetched
그래서 말이 안 돼요. 도움이 필요하세요?
$scope.load = function () {
//$scope.getContactsList();
var g = $rdf.graph();
var f = $rdf.fetcher(g);
f.nowOrWhenFetched($scope.path + '*',undefined,function(){
var DC = $rdf.Namespace('http://purl.org/dc/elements/1.1/');
var RDF = $rdf.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
var LDP = $rdf.Namespace('http://www.w3.org/ns/ldp#');
//var myOntology = $rdf.Namespace('http://user.pds.org/ontology/');
var VCARD = $rdf.Namespace('http://www.w3.org/2006/vcard/ns#');
var evs = g.statementsMatching(undefined, RDF('type'), VCARD('Individual'));
if (evs != undefined) {
for (var e in evs) {
var id = evs[e]['subject']['value'];
var fullname = g.anyStatementMatching(evs[e]['subject'], VCARD('fn'))['object']['value'];
var email = g.anyStatementMatching(evs[e]['subject'], VCARD('hasEmail'))['object']['value'];
var phone = g.anyStatementMatching(evs[e]['subject'], VCARD('hasTelephone'))['object']['value'];
var contact = {
id: id.slice(id.length-1),
Name: fullname,
Email: email,
Phone: phone
};
$scope.contacts.push(contact);
}
}
$scope.apply();
});
};
함수는$apply()
, 및$
.
언급URL : https://stackoverflow.com/questions/28307345/typeerror-scope-apply-is-not-a-function
반응형
'programing' 카테고리의 다른 글
Android 앱 리소스에서 JSON 파일 사용 (0) | 2023.03.16 |
---|---|
React 16의 fragments가 container div보다 나은 이유는 무엇입니까? (0) | 2023.03.16 |
반응 환원 용기 구성요소로 전달 소품 (0) | 2023.03.16 |
AngularJS에서 $broadcast 이벤트를 중지하려면 어떻게 해야 합니까? (0) | 2023.03.16 |
get_posts()에서 게시물 제외 (0) | 2023.03.16 |