Your Choice JavaScript News

Angularjs, javascript,

Angular News Tuesday, June 5

How to build a library for Angular apps? – Tomek Sułkowski – Medium

  • Lets follow a typical scenario: we are going to create a library that provides a service, a component and some interfaces.
  • As with a typical Angular project, you dont have to create a component by handits what the CLI is for: – ng generate component poster –project=tvmazeWe just needed to tell the CLI to create the poster inside our tvmaze library.
  • Use thelibraryTo try our library out, we need to do what we always would with 3rd party extensiondefine as a dependency in the imports section of the apps NgModule: – The thing to note here is that we dont import the class by a relative path to the tvmaze directory,…
  • When weve generated the library (ng generate library tvmaze ) Angular CLI modified the tsconfig.json in the root of our project by adding tvmaze to the paths entry.
  • Publish thelibraryTo make the library available on npm all you need to do is create a production build, and run npm publish command from the projects dist directory: – ng build tvmaze –prod – cd dist/tvmaze – npm publishIf you havent published anything before, you will need to create an…

Tags:

How to build a library for Angular apps? – Tomek Sułkowski – Medium

Building Custom Elements/Web Components with Angular 6

  • Install Angular CLI 6 and initialize theproject – npm i -g @angular/cli – ng new elements-demo –prefix customWere not doing anything special yet, so all the normal ng new parameters apply, you could add sass or anything to the mix, but here well stop at setting a custom prefix to,…
  • Create a component – Lets create one with Input and Output to see how they translate to custom elements that are understood by browsers: – ng g component button –inline-style –inline-template -v NativeWe use ViewEncapsulation.Native so that the styles are bundled with the template and the components class into one…
  • After adding some style template our button.component.ts looks like this: – You can copy this code from: Registering component inNgModule – This is the vital part: we use the Angulars createCustomElement function to create a class that can be used with browsers native customElements.define functionality.
  • Takes the component factorys inputs and outputs to convert them to the proper custom element API and add hooks to input changes.The configurations injector is the initial injector set on the class, and used by default for each created instance.This behavior can be overridden with the static property to affect…
  • In summary weve: – added elements-relared libraries with ng add command – registered the Angular component as custom element in a module – combined build artifacts into one file and gzipped them – – Not that difficult, right?

Tags:

Building Custom Elements/Web Components with Angular 6

NgRx — Best Practices for Enterprise Angular Applications

  • Feature store modules will be imported into the Root Store Module allowing for a single root store module to be imported into your applications main App Module.
  • Generate RootState interface to represent the entire state of your application using the Angular CLI: – – PLEASE NOTE: You will come back later on and add to this interface each feature module as a property.
  • Create feature store modules as proper Angular NgModules that bundle together feature slices of your store, including state, actions, reducer, selectors, and effects.
  • EffectsCreate an effects.ts file in the directory with the following: – – Now that we have created our feature module, either Entity or Standard typed above, we need to import the parts (state, actions, reducer, effects, selectors) into the Angular NgModule for the feature.
  • ts barrel export for your store with the following: – – Now that we have built our Root Store Module, composed of Feature Store Modules, lets add it to the main app.module.ts and show just how neat and clean the wiring up process is.

Tags:

NgRx — Best Practices for Enterprise Angular Applications

Top Angular Courses

Angular 5 (formerly Angular 2) - The Complete Guide (139,105 students enrolled)

By Maximilian Schwarzmüller
  • Develop modern, complex, responsive and scalable web applications with Angular 4
  • Fully understand the architecture behind an Angular 4 application and how to use it
  • Use their gained, deep understanding of the Angular 4 fundamentals to quickly establish themselves as frontend developers
  • Create single-page applications with on of the most modern JavaScript frameworks out there

Learn more.


The Complete Angular Course: Beginner to Advanced (40,747 students enrolled)

By Mosh Hamedani
  • Establish yourself as a skilled professional developer
  • Build real-world Angular applications on your own
  • Troubleshoot common Angular errors
  • Master the best practices
  • Write clean and elegant code like a professional developer

Learn more.


Learn and Understand AngularJS (66,998 students enrolled)

By Anthony Alicea
  • Learn fundamental Javascript concepts that power AngularJS.
  • Write quicker, better AngularJS code by discovering how AngularJS itself is built.
  • Become fluent in AngularJS terminology, such as dependency injection, services, directives, transclusion, and more.
  • Realize the power of dependency injection, and how AngularJS accomplishes it.
  • Design custom directives and save time and energy with easily reusable components.
  • Understand what a Single Page Application (SPA) is, and how they work.
  • Build a Single Page Application (SPA) in AngularJS.
  • Be the coder that explains AngularJS to everyone else, because you understand it better than anyone else.
  • Get new free lectures during 2015, keep up with the development of AngularJS 2.0, and get a MASSIVE discount on a future AngularJS 2.0 course in 2016!

Learn more.


Angular 5 NgRx Store Masterclass & FREE E-Book (3,038 students enrolled)

By Angular University
  • Build a Chat Application From top to bottom!
  • Understand the Flux Architecture, its benefits, strong points and most beneficial use cases
  • Understand Single Store Architecture solutions like Redux or Ngrx Store
  • Know all the usual notions of Store solutions, like Actions and Reducers
  • Know how to model the application state of a single store architecture, leveraging Typescript custom types to do so
  • Know the difference between a model and a view model and what to put inside the store
  • know how to derive a view model from a model and how to do that
  • understand the notion of selector in the context of store solutions
  • know the difference between smart components and presentation components
  • know how to build smart components using the Ngrx Store library
  • know how to use the Ngrx Effects library
  • know not only the Ngrx libraries but know also how they all fit together and what are the benefits of a store solution
  • know how to setup the Ngrx store developers tools
  • know how to debug RxJs applications in general

Learn more.


Angular Front To Back (6,984 students enrolled)

By Brad Traversy
  • Build amazing single page applications using Angular 5+
  • Master Angular concepts
  • Understand the file and folder structure of an Angular application
  • Build a client management application with authentication and Firebase's Firestore
  • Integrate Bootstrap 4 into Angular projects

Learn more.


Angular Crash Course for Busy Developers (44,316 students enrolled)

By Mosh Hamedani
  • Master the essential Angular concepts
  • Troubleshoot common runtime errors
  • Write cleaner, more maintainable code

Learn more.


Angular (Angular 2+) & NodeJS - The MEAN Stack Guide (26,806 students enrolled)

By Maximilian Schwarzmüller
  • Build real Angular + NodeJS applications
  • Understand how Angular works and how it interacts with Backends
  • Connect any Angular Frontend with a NodeJS Backend
  • Use MongoDB with Mongoose to interact with Data on the Backend
  • Use ExpressJS as a NodeJS Framework
  • Provide a great user experience by using Optimistic Updating on the Frontend
  • Improve any Angular (+ NodeJS) application by adding Error Handling

Learn more.