2014-11-09 2 views
2

Jquery와 angular가 혼합되어 있으며 Typeahead가 포함 된 대화 상자를 표시하려고합니다. 객관적인 이유 때문에 모달 바디를 표시하고 Angular typeAhead 지시문을 추가했습니다.Error : 컨트롤러 없음 : Angular Typeahead 용 ngModel

var cr = $('.modal-builder .modal-body').append('<div class="row"></div>'); 
$compile(cr)(scope); 

그러나 나는이 오류를 받고 있어요 :

$('.modal-builder .modal-body').append('<input type="text" placeholder="Start typing product title" typeahead="item.title for item in getAutoCompleteProducts($viewValue)" typeahead-loading="loadingLocations" class="form-control input inline" typeahead-wait-ms="200" typeahead-min-length="0" typeahead-on-select="insertProduct($item)" /><i class="fa fa-spinner fa-spin fa-lg" ng-show="loadingLocations" > </i>'); 

이 후 나는 그것을 컴파일하려고

Error: No controller: ngModel 

범위는 각도 부트 스트랩 대화 지침에서도있다. 그 안에는 TypeAhead로 대화를 표시하는 다양한 단추가 있습니다.

스택에 대한 다른 질문을 읽고 지침의 범위 사이에 오류처럼 보입니다. 나는 분리 된 범위를 수행함으로써 그것을 해결할 수 없었다.

완전히 새로운 범위로 컴파일해야합니까?

<input type="text" 
     ng-model="product.selected" 
     placeholder="Start typing product title" 
     typeahead="item.title for item in getAutoCompleteProducts($viewValue)" 
     ... 

을하지만 각도와 jQuery를 이러한 혼합은 아주 좋은 생각이 아니다 :

enter image description here

답변

1

은 선행 입력 템플릿에 ngModel 지시문을 추가합니다.

+0

이 작동하는 것 같습니다. 나는 Jquery를 제거해야한다, 나는 알고있다. 고맙습니다. –

+0

jQuery를 앵귤러, 더 많은 지시어와 함께 사용해야하며, 앵귤러 앱 지시문을 벗어난 DOM 조작은 피해야한다고 말하고 싶습니다. – dfsq

관련 문제