src/directive.js
function initializeNgModel() {
      if (ngModel === null) {
        return $q.resolve(null);
      }

      return $q((resolve) => {
        $timeout(() => {
          if (!(angular.isArray(ngModel.$modelValue) || angular.isNumber(ngModel.$modelValue))) {
            throw new Error(`Value provided in ngModel is not a valid noUislider start position. Expected a Number or an Array of Numbers, found: ${ ngModel.$modelValue }`);
          }

          resolve(ngModel.$modelValue);
        });
      });
    }
function initializeNgModel() {
      if (ngModel === null) {
        return $q.resolve(null);
      }

      return $q((resolve) => {
        $timeout(() => {
          if (!(angular.isArray(ngModel.$modelValue) || angular.isNumber(ngModel.$modelValue))) {
            throw new Error(`Value provided in ngModel is not a valid noUislider start position. Expected a Number or an Array of Numbers, found: ${ ngModel.$modelValue }`);
          }

          resolve(ngModel.$modelValue);
        });
      });
    }
A utility function that returns a promise which resolves when ngModel is correctly loaded,
using $timeout.

@return {Promise} Returns a promise that resolves with `null` when ngModel is null and thus
not in use. If the value entered for ngModel is not an array or number, an error is thrown
and thus the promise rejects. If the value entered for ngModel is correct, the promise
resolves with this value.