0
我想用AngularJS的Bootstrap-Confirmation插件,但我似乎無法讓指令正常工作。我使用的是YouTube視頻this。Bootstrap-Confirmation與AngularJS的jQuery插件
類似SO question使用另一個稱爲popConfirm的插件,但它以類似的方式使用。我試圖複製該指令,但這也沒有效果。
我想在點擊按鈕時顯示確認對話框,如果點擊「是」,那麼只有通過了ng-click功能。它使用JQuery的JSFiddle Demo。
這裏是我到目前爲止的Plnkr Demo。
腳本命令:
- 的jquery.js
- Angular.js
- UI-Bootstrap.js
- Bootstrap.css
- 自舉,Confirmation.js
- 應用.js
主要HTML:
<button class="btn btn-xs btn-primary" pop-confirm ng-click="confirm()">Confirm</button>
應用指令:
app.directive('popConfirm', function(){
var linker = function(scope, element, attr) {
element.confirmation();
};
return {
link: linker
};
});
我想要使用引導,確認插件si這似乎更優雅。有什麼辦法可以讓它起作用嗎?我提到的另一個SO問題是相似的,並且有一個解決方案。我不喜歡popConfirm,因爲popup/tooltip比我想要的大,否則我會嘗試。 – Dev
http://jsfiddle.net/nprL2pc3/ 檢查一下,它應該解決你的問題。對不起,回覆遲到 – Ash
感謝您的回覆,但我正在嘗試將其製作成指令,以便我可以在AngularJS中使用ti。 – Dev