Skip to content

Commit

Permalink
Merge pull request #112 from markleusink/master
Browse files Browse the repository at this point in the history
Fixes #109: error in AngularJS when the model property isn't defined …
  • Loading branch information
nosir authored Oct 5, 2016
2 parents fde9a65 + 0e9ff33 commit 5000443
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Cleave.angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ angular.module('cleave.js', [])
require: 'ngModel',

scope: {
cleave: '=',
cleave: '&',
onValueChange: '&?'
},

compile: function () {
return {
pre: function ($scope, $element, attrs, ngModelCtrl) {
$scope.cleave = new window.Cleave($element[0], $scope.cleave);
$scope.cleave = new window.Cleave($element[0], $scope.cleave() );

ngModelCtrl.$formatters.push(function (val) {
$scope.cleave.setRawValue(val);
$scope.cleave.setRawValue(val ? val : '');

return $scope.cleave.getFormattedValue();
});
Expand Down

0 comments on commit 5000443

Please sign in to comment.