don't run unit tests. use jshint.
parent
c7c955aee6
commit
2f5e5d415c
@ -1,16 +1,18 @@
|
|||||||
angular.module('radians.contenteditable', [])
|
angular.module('radians.contenteditable', [])
|
||||||
.directive('contenteditable', ->
|
.directive('contenteditable', ->
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
link: (scope, elm, attrs, ctrl) ->
|
link: (scope, elmt, attrs, ctrl) ->
|
||||||
# view -> model
|
# view -> model
|
||||||
view_to_model = ->
|
view_to_model = ->
|
||||||
scope.$apply ->
|
scope.$apply ->
|
||||||
ctrl.$setViewValue elm.html()
|
ctrl.$setViewValue elmt.html()
|
||||||
|
|
||||||
elm.bind 'blur', view_to_model
|
elmt.bind 'blur', view_to_model
|
||||||
elm.bind 'input', view_to_model
|
elmt.bind 'input', view_to_model
|
||||||
elm.bind 'change', view_to_model
|
elmt.bind 'change', view_to_model
|
||||||
|
|
||||||
# model -> view
|
# model -> view
|
||||||
ctrl.$render = -> elm.html ctrl.$viewValue
|
ctrl.$render = -> elmt.html ctrl.$viewValue
|
||||||
|
|
||||||
|
null
|
||||||
)
|
)
|
||||||
|
Reference in New Issue