Welcome to AngularBeans.
Angular Beans is a powerful web framework that enables the usage of AngularJS in Java EE through CDI. Angular Beans uses the power of both AngularJS and CDI to provide a lightweight but feature-rich framework. It simplifies the building of complex, real-time, JavaScript client side MV* , with JavaEE/CDI backend applications
Features
- Remote Method Invocation of CDI Beans (Json-RPC like protocol)
- Bean validation support (converted to client side AngularJS form validation)
- Built-in translation service
- Browser console logging via CDI beans
- Event-driven file uploads !
- Handles binary content (like images) as an AngularJS model
- SockJs support!
- Real-time Event driven publish-sucbscribe broadcasting system
- AngularJs Event's translated to CDI (backend) events
- ModelQuery: a query from the backend to front-end and updates model
Example
Consider the following CDI bean:
HelloBean.java :
package helloWorld; import angularBeans.api.AngularBean; import angularBeans.api.http.Get; @AngularBean public class HelloBean { @Get public String sayHello(String name) { return "hello " + name; } }
app.js :
'use strict'; angular.module('myModule', [ 'angularBeans' ]); angular.module('myModule') .controller('HelloCtrl', function($scope, helloBean) { $scope.sayHello = function(name) { helloBean.sayHello(name).then(function(result){ $scope.result=result; } ); } });
and the HTML5 file :
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <script type="text/javascript" src="angular/angular.min.js"></script> <script type="text/javascript" src="angular-beans.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body ng-app="myModule"> <div ng-controller="HelloCtrl"> <label>your name :</label> <input type="text" ng-model="name" /> <button ng-click="sayHello(name)">sayHello</button> {{result}} </div> </body> </html>
result :