버튼을 사용하여 트리거 된 각도를 학습하기 전에 프로젝트의 부트 스트랩 3 모달을 작성했습니다. 이제 각 변수를 사용하여 토글하고 싶습니다. 다음과 같이 this 기사에서 참조를 촬영, 난 내 코드를 단순화 :각도 변수를 사용하여 부트 스트랩 모달 토글
내 모달 HTML :
<div id="registered" tabindex="-1" modal-toggle role="dialog" aria-labelledby="registeredModal" aria-hidden="true" class="modal fade">
<div class="modal-dialog modal-lg">
...
...
</div>
</div>
modalToggle
지침 :
app.directive("modalToggle",function(){
return function(scope, element, attrs){
scope.$watch(scope.loaded.showModal, function(value) {
if (value) element.modal('show');
else element.modal('hide');
});
}
})
scope.loaded.showModal
이 후라고 다음 컨트롤러에 설정되어 양식 입력시 탭 클릭 :
app.controller('validatectrl',[ '$http', '$scope', '$upload', $location, function($http, $scope, $location){
unique: function(param){
$scope.loading={};
$scope.loaded={};
$scope.loading[param.field]=true;
var currentPath=$location.path();
var webCall = $http({
method: 'POST',
url: currentPath+'/validation',
async : true,
headers: {
'Content-Type': 'application/json'
},
timeout:10000,
data: param});
webCall.then(handleSuccess,handleError);
function handleSuccess(response) {
...
if(response.data.status===1) {
...
}
else if(response.data.status===0){
$scope.loaded["showModal"]=true;
alert("duplicate item");
}
}
function handleError(response){
$scope.loaded[param.field]={};
$scope.loading[param.field]=false;
$scope.loaded[param.field]["error"]=true;
$scope.loaded[param.field]["Message"]="Cannot fetch data from server";
};
}
모달을 제외하고 다른 모든 것이 작동하지 않습니다.
바닐라 부트 스트랩의 jQuery 기반 JavaScript 대신 https://github.com/angular-ui/bootstrap 또는 그와 비슷한 것을 사용해야합니다. – cvrebert
예 ... bt 나는 bootstrap의 jquery one에서 이미 프로토 타입을 만들었습니다 ... n 시간 제약이있었습니다 ... nw를 들여다 보면 ... 감사합니다 ... – Pravin