After death of few Angular1 componets, The rest remain Same?

Question!

I am just curious to know, Is it like after the removal of few components like :

enter image description here

The rest off other components will remain same, because it is not mentioned in the image above

like:

  1. Services,
  2. Event (broadcast, emit, on)
  3. run block
  4. constant
  5. config
  6. And many others.

Hope the above question is valid, If so please give me idea about what is still remains , so that I feel easier in learning/adapting the new angular 2.

TypeScript:

I have seen the changes in class oriented block changes in typescript like :

      class MyComponent {
          constructor() {
              this.name = 'Max'
          }
          sayMyName() {
              console.log('My name is', this.name)
          }
      }

Does that mean the commonly used DOM manipulation functions like

  1. document.getElementBy
  2. window object
  3. And other things will same to an extent ?

Please give me some reference or idea about How much the Typescript has changed

By : RAVI MONE


Answers

Based upon my understandings of how angular 2 is coming together this is how I see the other pieces fitting together.

Disclaimers

  • I am not a developer on the project, just a guy who is trying to keep up with the project as it is being developed.
  • The current state of angular 2 is alpha/developer preview and can/will change as development progresses

Overview

As angular 1.* progressed in its maturity there was a clear movement to utilizing conventional JavaScript patterns (see controllerAs, bindToController, no global controllers) and by following that convention your code for angular 1.* will be closer aligned to angular 2. The other movement that will assist you as you prepare for angular 2 is to think about your application in the idea of components (directive controller with services injected in).

Services

These are classes that can be injected into components

Events (broadcast/emit)

These are a pub/sub implementation based upon the inherited $scope model which is not going to be present in angular 2, so another eventing model will need implemented. I have not heard this discussed from the angular team, so either be patient or pick another pub/sub model to implement.

Run block

With angular 2 being component based when the app is run is a direct correlation with the constructor of the root component (the one being bootstrapped)

Constants

Constants in angular 1 are just values that can be injected into other components, nothing has changed here and values can be injected into components in angular 2.

Config

With the angular module system going away in lieu of ES6 modules the idea of configuration (initializing values for a service) can be done in the constructor of the service. Also, angular 2 is going to support the idea of lazy loading additional components so configuration can be done later as well as upon application start

references

By : Brocco


Question 1:

The high-level abstraction is still the same (controllers, directives, services), but all the implementation details changed as the framework is rewritten in TypeScript.

For example, angular modules will be ditched in favour of ES6 native ones, which means run block, constant and config will not be relevant. Howevver, since they're keeping dependency injection, some way of configuration must exist, so whatever you can do in config and run will still be doable.

Question 2:

You probably confused TypeScript with JavaScript. The former has always had a syntax like that (so will the next version of JavaScript (ES6/harmony) to some extent).

However, the language change does not affect how you use the framework as TypeScript is supposed to be a superset of JavaScript, so most valid JS is also valid TS. You do not have to use features specific to TypeScript if you don't want to.

By : billc.cn


This video can help you solving your question :)
By: admin