angular-experiment
v1.0.21
Published
An angular directive and service that wrap the tiny-experiment npm module
Downloads
10
Maintainers
Readme
angular-experiment
Angular directive and service that wrap npm module, tiny-experiment.js
Quick start
- Install module
npm install angular-experiment
- Require
require('angular-experiment')
angular.module('mainApplication', ['tiny.experiment'])
Register experiment see: https://github.com/genelee/tiny-experiment
Use in javascript with $experiment service
angular.module('mainApplication').controller('mainController', ['$experiment', function($experiment) {
$experiment.getExperiment('buttonStyle')
.on('blue', function() {
$('#my-button').css('backgroundColor', 'blue')
})
.on('red', function() {
$('#my-button').css('backgroundColor', 'red')
})
.run()
}])
- Use in directive without writing any javascript
<div tiny-experiment="buttonStyle" variant="blue" class="blue-button"></div>
<div tiny-experiment="buttonStyle" variant="red" class="red-button"></div>