Module: TagSet

TagSet

TagSet Provider
Author:
  • Marco Lehmann <marco.lehmann (at) kiwigrid.com>
Source:

Classes

ketaTagSetProvider
TagSet
TagSetInstance

Methods

<inner> add(tag) → {TagSetInstance}

Adds a Tag object to the TagSet if it doesn't exist already. In this case nothing will be changed.

Parameters:
Name Type Description
tag TagInstance Tag to add
Source:
Returns:
TagSetInstance TagSetInstance with added TagInstance
Example
angular.module('exampleApp', ['keta.services.TagSet'])
    .controller('ExampleController', function(ketaTagSet) {
        ketaTagSet
            .create()
            .add(Tag.create({
                guid: 'guid',
                name: 'name',
                sampleRate: 10
            }));
    });

<inner> create() → {TagSetInstance}

Creates a TagSetInstance.

Source:
Returns:
TagSetInstance TagSetInstance created
Example
angular.module('exampleApp', ['keta.services.TagSet'])
    .controller('ExampleController', function(ketaTagSet) {
        var tagSet = ketaTagSet.create();
    });

<inner> getTags() → {Array}

Returns tags as an Array.

Source:
Returns:
Array tags
Example
angular.module('exampleApp', ['keta.services.TagSet'])
    .controller('ExampleController', function(ketaTagSet) {
        var tagSet = ketaTagSet.create();
        var tags = tagSet.getTags();
    });

<inner> getTagsAsHierarchy() → {Object}

Returns tags as hierarchically organized Object. First level represents devices specified by guid property. On the second level name property is used as key pointing to the Tag object.

Source:
Returns:
Object tagsAsHierarchy
Example
angular.module('exampleApp', ['keta.services.TagSet'])
    .controller('ExampleController', function(ketaTagSet) {
        var tagSet = ketaTagSet.create();
        var hierarchy = tagSet.getTagsAsHierarchy();
    });

<inner> remove(tag) → {TagSetInstance}

Removes a Tag object from the TagSet if it still exists. Otherwise nothing will be changed.

Parameters:
Name Type Description
tag TagInstance Tag to remove
Source:
Returns:
TagSetInstance TagSetInstance with removed TagInstance
Example
angular.module('exampleApp', ['keta.services.TagSet'])
    .controller('ExampleController', function(ketaTagSet) {
        var tag = Tag.create({
            guid: 'guid',
            name: 'name',
            sampleRate: 10
        });
        ketaTagSet
            .create()
            .add(tag)
            .remove(tag);
    });