Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to angularjs 2? #24

Open
pdonorio opened this issue May 24, 2016 · 18 comments
Open

Migration to angularjs 2? #24

pdonorio opened this issue May 24, 2016 · 18 comments

Comments

@pdonorio
Copy link
Owner

A good starting point could be angular-cli:

https://scotch.io/tutorials/use-the-angular-cli-for-faster-angular-2-projects

@pdonorio
Copy link
Owner Author

Also moving towards ES6 this is a package manager that is really shining:

https://github.com/rollup/rollup

@mdantonio
Copy link
Collaborator

python-like imports... interesting

@pdonorio
Copy link
Owner Author

pdonorio commented Jun 2, 2016

Just to add comparison to the discussion: http://aurelia.io/docs.html#/aurelia/framework/latest/doc/article/getting-started

@pdonorio
Copy link
Owner Author

pdonorio commented Jun 8, 2016

Another important concept is that Angularjs 1.5 has added few things which lie in the middle of angular 1 and 2. For example see how components (ex directives) works now:

https://toddmotto.com/angular-1-5-lifecycle-hooks

@pdonorio
Copy link
Owner Author

Also, to get up to speed with 1.5, from https://toddmotto.com/rewriting-angular-styleguide-angular-2:

These still exist in Angular 1.x, however I feel they should be treated as deprecated and advise against them.

Two-way databinding through { foo: '=' } syntax
controllerAs syntax
$scope in controllers
$scope.$watch, seriously, you don’t need it (link function is ok for watching attributes/plugin properties etc)
The event system (in the application layer, for routing statechange events for authorisation are still a good use case)
These properties on Directives:
scope
bindToController
controller
controllerAs
require
template
templateUrl
transclude
Why? Use .component() because that’s the correct tool now
The .factory() method
Use an ES2015 Class for a Service, like in Angular 2
The .controller() method
Use controller: fn on components only
Using template: '<my-component>' with ui-router
Favour component: 'myComponent' and route to components
Some form of router.js file
We now have “routed components” with individual routing definitions

@pdonorio
Copy link
Owner Author

pdonorio commented Aug 1, 2016

A free angularjs 2 video course is here:
http://courses.angularclass.com/courses/angular-2-fundamentals

It requires registration.

@pdonorio
Copy link
Owner Author

pdonorio commented Aug 2, 2016

Slides to make up to the new system:
http://slides.com/austinmcdaniel/angular-2/#/

@pdonorio
Copy link
Owner Author

pdonorio commented Aug 2, 2016

Note: one possible alternative to angularjs (probably the only one, at least to my eyes) is the aurelia framework.

It's (much) simpler to install and configure and launch with nodejs, I just tested it.

It also has a cool integration with material design lite thanks to this plugin.

Since yesterday I tried to start an angular2 project and felt bad as 2 years ago when trying yoeman and grunt, we might really understand the risks of angular2.

In the meanwhile we should really exploit the angularjs1.5+ component as an alternative on starting to write our own custom tags.

@pdonorio
Copy link
Owner Author

While on vacation I was reading here and there a lot of people complaining about the direction that angularjs2 is taking comparing to how the javascript developers took.

So React is the other way aroung. Based on this interesting article:

"For the long term, I, personally, would choose React, using Redux architecture, Axios for promise-ready HTTP requests and react-router. "

Uhm. Don't know. I'll keep adding notes here to take a better decision at the end of the year.

@pdonorio
Copy link
Owner Author

pdonorio commented Sep 6, 2016

It's easier https://codequs.com/p/BksMQsdWj/why-angular2-is-easier-than-angularjs but yet the compile problem is very heavy

@pdonorio
Copy link
Owner Author

pdonorio commented Sep 6, 2016

An approach in the middle:
move towards how React work, but keeping using angularjs1.

To do so, we can interact with Redux. See this tutorial with ngRedux to get the sense of how redux works.

The syntax is a little bit different.
In fact files and packages are imported python-like, with a bundler.
This means getting back to gulp&browserify; using nodejs to serve files in development for the frontend...
If we want to test it, see here.

Note: inspired by this tweet

@pdonorio
Copy link
Owner Author

More info to migrate to angularjs2 from 1:
https://www.angular2patterns.com/

@pdonorio
Copy link
Owner Author

Another great resource for migration, by our friend Todd
http://ngmigrate.telerik.com/

@pdonorio
Copy link
Owner Author

Un interessante componente "auth0" a costo nullo per gli sviluppatori, che funzionerebbe su angular1 e 2 https://auth0.com/blog/angular-2-authentication/

@pdonorio
Copy link
Owner Author

pdonorio commented Oct 6, 2016

So what's the problems with frontend development?
This article sums it up, on a JS point of view.

At the very minimum in this issue we should somehow not forget that in JS we must keep in mind that simpler is better.

So should we consider as another option going to move to something more close to plain vanilla JS? Some example are vue or elm.

Or: should I stop working on frontend development?

@pdonorio
Copy link
Owner Author

pdonorio commented Oct 12, 2016

In this discussion, writing clear angularjs, and use that MVC pattern to its best, is a key point. Somebody wrote about it:
https://www.simple-talk.com/dotnet/net-development/4-keys-clean-angular-implementation

Basically it tells developers to use functions instead of expressions, variables and code in the View. I almost agree, the problem is about the digest cycle evaluation and performances when doing so.

@pdonorio
Copy link
Owner Author

pdonorio commented Nov 5, 2016

In case of getting better with angularjs 1.x, here's what to read.

@pdonorio
Copy link
Owner Author

So reading the latest from todd I have the feeling that angularjs1 won't be enough for us. Since react doesn't even have routing and we rely a lot on that, the last thing to check to understand if we need angularjs2 is a prototyping example to create two similar controllers.

Maybe @mdantonio can think of this example and I can create a nodejs container to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants