AngularBeans : Step By Step Tutorial



STEP5: angularBean and NGLogger


We will see now another cool feature of angularBeans: logging:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package examples.angularbeans;

import javax.inject.Inject;
import angularBeans.api.http.Get;

import angularBeans.api.AngularBean;
import angularBeans.api.NGModel;
import angularBeans.api.NGReturn;
import angularBeans.log.NGLogger;
import angularBeans.log.NGLogger.Level;

@AngularBean
public class HelloBean {

	private String name = "insert your name here";

	@Inject
	NGLogger logger;

	@Get
	@NGReturn(model = "message")
	public String sayHello(String name, Language language) {
		this.name = name;

		logger.log(Level.DEBUG, "this is a DEBUG");
		logger.log(Level.WARN, "this is a warning %s", name);

		return "Hello " + name + " from angularBeans! , your language is "
				+ language.getValue();

	}

	@NGModel
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}

Just open the browser console and rerun the example:

next step:

<STEP6: ModelQuery>




Support or Contact

Having trouble with Pages? Check out the documentation at https://help.github.com/pages or contact support@github.com and we’ll help you sort it out.