My experience with Angular2 – (project and npm package)

Angular2, AngularJS, Javascript

I have about 2 year with Angular, with the first version, and I have a some repos with that about a little experiments for specifics ideas.

Here, my last repo:

And now, from some months ago, I have started to test with Angular2, the new tendency :). As you can know, now Angular2 is  oriented by components, like ReactJS. You can see that all files are like “directives”, and the control into this class is the controller. I will talk about only some differences and curiosities, I will not enter in deep how to work with Angular2.

Now, in your template, you and use the component like  <app></app>,<div app></div>,<div class="app"></div> in the html as previous version. Is not necessary add ng-app, ng-controller like Angular1.x.

The component that you want use in html (app for example), should be have this code:

Other thing that has changed, is the service, provider and factory not exist, only Service.

Ran out the doubts about if we should use service, provider or factory to do a service.

And other thing important for me, is that now is very easy to do a load lazy a component, you have not use libs like ocLazyLoad

Finally, Angular2 is very very easy to learn, the transition from Angular1.x it has been confortable, only you need to dedicate time to search and try thing to understand.

During my learning, I tried to do a component and also I published it for know how to do a library and install it in other project, and was born the following npm package:

And I did the component ng2-notify

This component is for show a notification in the UI when you do some action. You can see a demo in following url: ( ) Now, it is a 1.3.o version with Angular2 Beta 9.
Please!! if yo have some doubt, find some bug or you want a feature, let me know and open a Pull Request about.


So, it is all, if you want show a little project, I did (I am doing fix and improvements little by little) a little project ) with gulp, nodeJS + MongoDB for API, SASS (compass).

Thanks for read me, I hope that my experience that helped you.

tags: , , , ,

  • Clay Stewart

    How do you compile the angular2 tsc so that another project can costume it? I am looking for some resource on how to do this.

    • dimaslz

      Hi Clay, thanks for your comment.

      If you see my repo you can see that exist a file notify.js and notify.d.ts into “dist” folder, that they are the connection to the component.

      Now, you can see in this file (other app) that in line 95 I get the files into “dist” and now, in my index.html, I set the config systemjs

      after, I can do the import {Ng2-notify…} from ‘ng2-notify/notify’

      “notify” after ng2-notify, es the file before mentioned notify.js and notify.d.ts into “dist” folder.

      I hope this helps. If you want talk, send me a mail and I can try to explain more.