我試圖寫的jeditable插件,所以當它改變了價值,這也將改變編輯編輯元素的模型指令。angularJS +的jQuery插件jeditable一起工作
所以我寫了類似的東西,JS Fiddle 但我不知道如何獲得綁定到列表中的對象的對象。
JS:
var app = angular.module("app", []);
app.controller('ctrl', function ($scope) {
$scope.lst = [{
id: 1,
name: "item1"
}, {
id: 1,
name: "item1"
}, {
id: 2,
name: "item2"
}, {
id: 3,
name: "item3"
}, {
id: 3,
name: "item3"
}];
});
app.directive('uiEditable', function() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.editable("/echo/json/", {
onblur: 'submit',
onsubmit: function (response, settings) {
//here i need to update the model
}
});
}
};
});
謝謝你,找了如何樣式代碼... – CaTz