Created
July 11, 2013 09:34
-
-
Save capaj/5974029 to your computer and use it in GitHub Desktop.
showcase how on-change attribute parsing can help with updating the relevant objects on scope. Looking at it now, maybe instad of parsing on-change, we could change it to ng-change to align the name with angular.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="langsCtrl"> | |
<tr ng-repeat="lang in langsList"> | |
<td>{{$index}}</td> | |
<td> | |
<div class="ade-editable" ade-text='{"className":"inputInTable"}' | |
ng-model="lang.lang_code" on-change='update(lang)'>{{lang.lang_code}}</div> | |
</td> | |
<td> | |
<div class="ade-editable" ade-text='{"className":"inputInTable"}' | |
ng-model="lang.alt" on-change='update(lang)'>{{lang.alt}}</div> | |
</td> | |
<td><div class="ade-editable" ade-text='{"className":"inputInTable"}' | |
ng-model="lang.icon" on-change='update(lang)'>{{lang.icon}}</div></td> | |
<td><input ng-model="lang.enabled" type="checkbox" ng-change="update(lang)"></td> | |
<td> | |
<i class="icon-remove" ng-click="delete(lang, $index)" ></i> | |
</td> | |
</tr> | |
</div> | |
<script> | |
function langsCtrl($scope){ | |
$scope.update = function (lang) { | |
//put updated lang to server | |
}; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment