This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Home
Lars Gersmann edited this page Jul 22, 2013
·
12 revisions
Live demo : http://ampere.eu01.aws.af.cm/
Website : http://lgersman.github.com/jquery.orangevolt-ampere/
A detailed documentation will be available here.
Until then, have a look at this "Ok, got it !" ampere module/application as a starter ...
Dig into the examples folder for many many more examples.
<script type="text/javascript">
var greet = ov.ampere().module( function greet( module) {
module.state( {
main : function() {
this.transition( module.states.greet)
.enabled( function() {
return document.forms[0].checkValidity();
});
this.value="";
this.view( document.getElementById( 'main'));
},
greet : function() {
this.transition( module.states.main);
this.view(
'<h4>Hello {{$ampere.module.states.main.value | ucwords}} !</h4>' +
'<button ng-ampere-transition="$ampere.view.state().transitions.main"></button>'
);
}
})
.options({
'ampere.ui.about' : 'This is a sample <a target="_blank" href="https://github.com/lgersman/jquery.orangevolt-ampere">Ampere</a> application.',
'ampere.ui.about.url' : 'https://github.com/lgersman/jquery.orangevolt-ampere'
});
});
$( window).ready( function() {
$( 'body').ampere( greet);
});
</script>
<script id="main" type="text/template">
<form>
<label>
Enter name to greet:
<input type="text" ng-model="value" required>
</label>
<br>
<submit ng-ampere-transition="$ampere.view.state().transitions.greet">
</form>
</script>