Angular-xeditable şablonu
A Pen by Recai Oktaş on CodePen.
Angular-xeditable şablonu
A Pen by Recai Oktaş on CodePen.
<h4>Angular-xeditable demo</h4> | |
<div ng-app="app" ng-controller="Ctrl" style="margin: 50px"> | |
<a href="#" editable-text="user.name">{{ user.name || 'empty' }}</a> | |
<br><br> | |
<a href="#" editable-select="user.status" e-ng-options="s.value as s.text for s in statuses"> | |
{{ showStatus() }} | |
</a> | |
<br><br> | |
debug: {{ user | json }} | |
</div> |
app = angular.module("app", ["xeditable"]) | |
app.run (editableOptions) -> | |
editableOptions.theme = "bs3" | |
app.controller "Ctrl", ($scope, $filter) -> | |
$scope.user = | |
name: "cezmi seha sahir" | |
status: 2 | |
$scope.statuses = [ | |
value: 1 | |
text: "status1" | |
, | |
value: 2 | |
text: "status2" | |
, | |
value: 3 | |
text: "status3" | |
, | |
value: 4 | |
text: "status4" | |
] | |
$scope.showStatus = -> | |
selected = $filter("filter")($scope.statuses, | |
value: $scope.user.status | |
) | |
(if ($scope.user.status and selected.length) then selected[0].text else "Not set") |