All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cat-boot-enum.cat-boot-enum-directive.js Maven / Gradle / Ivy

/**
 * @author Thomas Scheinecker, Catalysts GmbH.
 */

define([
    'angular',
    './cat-boot-enum-service.js'
], function (angular,
             cbEnumServiceModule) {
    'use strict';

    /**
     * @param {$compile} $compile
     * @param {CatBootEnumService} cbEnumService
     * @returns {{restrict: string, require: string, scope: boolean, link: link}}
     */
    function cbEnum($compile, cbEnumService) {
        return {
            restrict: 'A',
            require: '?ngModel',
            scope: false,
            link: function ($scope, $element, $attrs, ngModel) {
                if (!$element.is('select')) {
                    throw new Error('cb-enum can only be used with