more angularjs and hierarchies

This week has been spent working more on the hierarchies page using angularjs. AngularJs has a much higher learning curve than learning something like lucene but if you pay your dues and really try to understand how to use it then it is a very powerful tool.

I think we are finally coming close to the final stretch and I am going to meet my personal goal of getting a nice tool for viewing the Snomed CT terms in a hierarchy. I think this kind of tool has a lot of potential for being very useful if added on to in the future and so this has been the most important accomplishment for me. I still have some work to do but I feel more confident now that it will all be done in the end.

Here is some more information on AngularJs:

Here is an exert from the docs.angularjs.org/guide/ website that I find to be one of the most powerful tools in using AngularJs. It is about the directives:

“Directives are a way to teach HTML new tricks. During DOM compilation directives are matched against the HTML and executed. This allows directives to register behavior, or transform the DOM.

Angular comes with a built in set of directives which are useful for building web applications but can be extended such that HTML can be turned into a declarative domain specific language (DSL).”

I do all of my service calls with factories and they usually are making an ajax call to my fragment controller:

“While Angular offers several useful services, for any nontrivial application you’ll find it useful to write your own custom services. To do this you begin by registering a service factory function with a module either via the Module#factory api or directly via the $provide api inside of module config function.

All Angular services participate in dependency injection (DI) by registering themselves with Angular’s DI system (injector) under a name (id) as well as by declaring dependencies which need to be provided for the factory function of the registered service. The ability to swap dependencies for mocks/stubs/dummies in tests allows for services to be highly testable.” (http://docs.angularjs.org/guide/dev_guide.services.creating_services)

One of the last important pieces is the Controller:

In Angular, a controller is a JavaScript function(type/class) that is used to augment instances of angular Scope, excluding the root scope.

Use controllers to:

As you can see with these key pieces AngularJs makes it easy to write code following MVC.

I will say the only way to learn AngularJs is to just try and keep working at it. I could not find any tutorials that could get all the way into advanced use. It is a lot of trial and error.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s