TagSet Provider
- Copyright:
- Kiwigrid GmbH 2014-2015
- Source:
Classes
Methods
- <inner> add(tag) → {TagSetInstance}
- <inner> create() → {TagSetInstance}
- <inner> getTags() → {Array}
- <inner> getTagsAsHierarchy() → {Object}
- <inner> remove(tag) → {TagSetInstance}
-
<inner> add(tag) → {TagSetInstance}
-
Adds a
Tag
object to theTagSet
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 TagInstanceExample
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 createdExample
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 tagsExample
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 levelname
property is used as key pointing to theTag
object.- Source:
Returns:
Object tagsAsHierarchyExample
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 theTagSet
if it still exists. Otherwise nothing will be changed.Parameters:
Name Type Description tag
TagInstance Tag to remove - Source:
Returns:
TagSetInstance TagSetInstance with removed TagInstanceExample
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); });