src/factory/validateFact.js
function (scope, iAttrs, newValue) {
    'use strict';
    var ngModelArr = iAttrs.ngModel.split('.');
    // console.log(JSON.stringify(ngModelArr, null, 2));


    switch (ngModelArr.length) {
    case 1:
        scope.$apply(function () {scope[ngModelArr[0]] = newValue;});
        break;
    case 2:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]] = newValue;});
        break;
    case 3:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]] = newValue;});
        break;
    case 4:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]] = newValue;});
        break;
    case 5:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]][ngModelArr[4]] = newValue;});
        break;
    default:
        scope.$apply(function () {scope[iAttrs.ngModel] = newValue;});
    }

}
function (scope, iAttrs, newValue) {
    'use strict';
    var ngModelArr = iAttrs.ngModel.split('.');
    // console.log(JSON.stringify(ngModelArr, null, 2));


    switch (ngModelArr.length) {
    case 1:
        scope.$apply(function () {scope[ngModelArr[0]] = newValue;});
        break;
    case 2:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]] = newValue;});
        break;
    case 3:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]] = newValue;});
        break;
    case 4:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]] = newValue;});
        break;
    case 5:
        scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]][ngModelArr[4]] = newValue;});
        break;
    default:
        scope.$apply(function () {scope[iAttrs.ngModel] = newValue;});
    }

}
function ( scope , iAttrs , newValue ) { 'use strict' ; var ngModelArr = iAttrs . ngModel . split ( '.' ) ; // console.log(JSON.stringify(ngModelArr, null, 2)); switch ( ngModelArr . length ) { case 1 : scope . $apply ( function ( ) { scope [ ngModelArr [ 0 ] ] = newValue ; } ) ; break ; case 2 : scope . $apply ( function ( ) { scope [ ngModelArr [ 0 ] ] [ ngModelArr [ 1 ] ] = newValue ; } ) ; break ; case 3 : scope . $apply ( function ( ) { scope [ ngModelArr [ 0 ] ] [ ngModelArr [ 1 ] ] [ ngModelArr [ 2 ] ] = newValue ; } ) ; break ; case 4 : scope . $apply ( function ( ) { scope [ ngModelArr [ 0 ] ] [ ngModelArr [ 1 ] ] [ ngModelArr [ 2 ] ] [ ngModelArr [ 3 ] ] = newValue ; } ) ; break ; case 5 : scope . $apply ( function ( ) { scope [ ngModelArr [ 0 ] ] [ ngModelArr [ 1 ] ] [ ngModelArr [ 2 ] ] [ ngModelArr [ 3 ] ] [ ngModelArr [ 4 ] ] = newValue ; } ) ; break ; default : scope . $apply ( function ( ) { scope [ iAttrs . ngModel ] = newValue ; } ) ; } }
Update scope value. Usually on autocorrection.
@param  {Object} scope  - angular $scope object
@param  {Object} iAttrs - attribute object which contains HTML tag attributes
@param  {Mixed}        - new value
Update scope value . Usually on autocorrection .