Top 12 Productivity Tips for WebStorm and Angular – Part 1

This article was sponsored by JetBrains. Thank you for supporting the partners who make SitePoint possible.
In this 2-part series, Google Developer Experts Jurgen Van de Moere and Todd Motto share their favorite productivity tips for developing Angular applications using WebStorm.
In this first part, Jurgen shares his personal top 5 WebStorm features that allow him to increase his productivity on a daily basis:

Use Angular CLI from within WebStorm
Navigate like a pro
Take advantage of Angular Language Service
Auto format your code
Optimize your imports

Each tip can tremendously increase your development productivity, so let’s dig into them a little deeper one by one.
Tip 1: Use Angular CLI from Within WebStorm
Angular CLI is a Command Line Interface (CLI), written and maintained by the Angular team, to help automate your development workflow. You can use it to quickly create new Angular projects and add new features such as components, services and directives to existing Angular projects.
WebStorm’s integration with Angular CLI provides you with all its power right from within WebStorm, without using the terminal.
To create a new Angular Project, choose File | New | Project and select Angular CLI.
Enter a project location and hit the Create button. WebStorm uses Angular CLI to create a new Angular project and install dependencies.
When your new Angular application is in place, you can easily add new Angular features. Right click on src/app and choose New | Angular CLI to pick the type of feature you wish to add.
Once you’ve selected a feature, you can specify the name and optional parameters, just as you would with Angular CLI on the command line:

To learn more about Angular CLI options and parameters, make sure to check out The Ultimate Angular CLI Reference.

What’s really awesome is that WebStorm automatically adds the component to the right Angular module for you, in this case AppModule.
If your application has multiple Angular modules, right click on the module you wish to add the feature to and choose New | Angular CLI. WebStorm will make sure the new files are created in the right location and that the new feature is added to the correct Angular module.
How sweet is that!
Tip 2: Navigate Like a Pro
Use cmd-click or cmd-B to easily jump to any definition within your project.
If you are a keyboard user, just put your cursor on a term and hit cmd-B. If you are a mouse user, hold down the cmd button and all terms you hover will turn into links to their definition.
WebStorm automatically recognizes Angular components and directives in your HTML, links to stylesheets, links to templates, classes, interfaces and much more.
No need to open file(s) manually, just jump to any definition you need:

When looking for a file that you don’t have an immediate reference to, hit shift twice to open the Search everywhere dialog. You don’t have to type the entire search string. If you want to open AppComponent, just type the first letter of each part — i.e. ac — and WebStorm will immediately narrow down the result list for you, so you can quickly pick the suggestion you wish to open:

Another super useful navigation shortcut is cmd-E, which presents you with a list of recently edited files so you can easily navigate back and forth between them.

Knowing how to quickly navigate to the code you need will save you a tremendous amount of time every single day.
Tip 3: Take Advantage of Angular Language Service
Angular Language Service is a service, designed by the Angular Team, to provide IDEs with error checking and type completion within Angular templates.
WebStorm integrates with Angular Language Service to better understand your code. To enable Angular Language Service, first make sure it is installed:
npm install @angular/language-service –save-dev

If you use Angular CLI to generate an Angular application, Angular Language Service is automatically installed.

Next, go to Preferences | Languages & Frameworks | TypeScript, make sure Use TypeScript Service is checked and click Configure…:

The Service Options modal will pop up. Enable Use Angular service and apply the changes:

By default, WebStorm already provides great assistance for writing Angular code.
When editing a script, WebStorm automatically imports the required JavaScript modules so you don’t have to import them manually.
If you open up the TypeScript panel, WebStorm provides you with immediate feedback on the validity of your code, so you can quickly resolve issues before having to compile your project.
Watch how the OnInit interface is automatically imported and how the live TypeScript feedback immediately tells you whether or not your TypeScript code is valid:

When you edit a template, WebStorm provides you with smart code completion that recognizes components, directives and even input and output properties:

With Angular Language Service enabled, WebStorm is able to improve code completion in template expressions:

… and report template errors more precisely right inside your editor:

Catching errors without having to compile your project saves you incredible amounts of time.
Tip 4: Auto-format Your Code
Don’t worry about formatting your code manually. WebStorm has you covered.
Whether your are in a template, a script, a stylesheet or even a JSON file, just hit cmd-option-L and WebStorm will automatically format all code for you:
Continue reading %Top 12 Productivity Tips for WebStorm and Angular – Part 1%


Angular 5 Release Imminent!

Front-end developers, rejoice – after a short delay, the Angular 5 release is scheduled for October 23rd!

Several beta releases have been available since August, and this version is now at the release candidate stage. Being the first major release since version 4 in March (yes, there never was an “Angular 3” – see here to find out what happened), what key Angular 5 features can you expect to find? Read on to find out …
Top Angular 5 Features


Chasing the Holy Grail of NG Development: Angular CLI, npm Library, and Packaging

It is amazing how far we have come on the JavaScript side of the house. Creating UI richness in the browser has always been the holy grail. From Flash to Applets to old-school DHTML and outside solutions like Java Webstart, we have never been as close to that holy grail of rich desktop-like applications in the browser as we are today.
The combination of HTML 5 and Angular 2+ (NG2) has brought us closer to Avalon than ever before. Using these two recent technologies, front-end web developers have created richer desktop-like apps in recent years than any single library or technology has before. HTML 5 and NG2 development does not require a browser plugin or some other client-side binary to be installed like a Flash or Java solution and it works well across browsers and operating systems. While NG2 has a lot to offer, it also brought some complexity to the JavaScript side of the equation that was not previously as common when using good old jQuery. Not only does NG2 rely heavily on ASYNC programming but also carries with it a number of established OO Design Patterns. All of this is accomplished through TypeScript. While it is true, at the end of the day, that code in the browser is just plain old JavaScript, it is written as TypeScript and gets compiled. This provides us lots of benefits like compile-time checking of code and even some interesting performance options using NG Ahead-of-Time Compilation.


Learning Angular: Everything You Need to Get Started

Whether it’s AngularJS 1.X – a framework, or Angular – a platform, Google’s Angular project has taken over the web. Here’s a collection of articles, projects and courses that’ll help you get to grips with the powerful front-end tool.
But if you’re starting from scratch, and you’d like to go from zero to expert fast, a course recommendation. For expert-led online Angular training courses you can’t go past Ultimate Angular by Todd Motto. Try his courses here [ultimateangular], and use the code SITEPOINT to get 25% off and to help support SitePoint.
Introductions and Comparisons

Angular version naming got a little complicated this year, here are the official naming conventions for specific versions of the platform [angularjs], which we’ve tried to follow here and elsewhere on the site.
How to decide between React and Angular [sitepoint].


How to create a single-page app with AngularJS and the WordPress REST API [sitepoint].
A guide to managing state in Angular apps with ngrx/store [sitepoint].
Managing state in Angular apps [blog.nrwl].
Persisting state in AngularJS [sitepoint].
How to build maintainable Angular apps [medium/curated-by-versett].
How to develop apps with Angular mockbackend [sitepoint].
A community-drive collection of best practices and style guidelines for AngularJS [github/mgechev].


A guide to testing your services with Angular [corinnekrych.blogspot].
How to test your Angular component [corinnekrych.blogspot].


Angular authentication with JSON [angularjs.blogspot].
And easy Angular authentication with Auth0 [sitepoint].

Slightly More Advanced

Developing an app with Angular 2+ and the Angular CLI [sitepoint]
An anatomy of a large Angular application [medium]
Creating Progressive Web Apps with Angular [medium]
Improving Angular performance with one line of code [blog.upstate]
Building Angular apps at scale [medium]
Track device geolocation in NativeScript Angular mobile applications [thepolyglotdeveloper]
Deploy your own REST API using mLab and Heroku [sitepoint]

You’ve got the basics – and perhaps even a little bit more. Here are some projects to take on to put that knowledge into practice.
Continue reading %Learning Angular: Everything You Need to Get Started%


JavaScript Frontend Framework CLI Showdown

Many modern JavaScript frontend frameworks are complemented by a standalone Command Line Interface (CLI) program that assists with setting up a suitable development environment. Since many developers who work with Stream also use one or more of these frameworks, we like to stay up to date. We’re also happy to pass on what we’ve learned. This post offers both rookie and veteran developers a breakdown and comparison of the CLI programs available for Angular, React, and Vue. The aim is to help new developers understand the benefits and tradeoffs associated with using a CLI tool as opposed to setting up the associated tooling from scratch. Experienced developers will appreciate a quick, yet thorough and independent comparison to refer to. This isn’t a benchmark and there isn’t a winner announced; as with most tools, it is a case of “horses for courses."


Developing a Web Application Using Angular (Part 5)

In the previous four parts of this series, we started with a simple goal of creating a web application to view, create, update, and delete orders from our order management web service and ultimately constructed an Angular Single Page Application (SPA) that accomplished this goal. In Part 1, we developed a User Interface (UI) design and laid out our plan of action; in Part 2, we developed an architecture for our web application and implemented the resource layer; in Part 3, we implemented our service layer and solidified our abstraction of the order management web service; in Part 4, we tied the web application together by implementing the UI layer and bootstrapping the application to run in conjunction with the order management web service.
In the final part of this series, we will start both the order management web service and our newly developed web application and demonstrate some of the debugging and inspection tools that can be used to ensure that our application functions as intended. We will also explore some of the testing frameworks that can be used to automate our manual testing processes, as well as some additional features that are common among more complex web applications. Before we delve into these supplemental topics, though, we must start the web application and web service and ensure that our web application is functioning as intended.


Simplifying Content Projection in Angular

In Angular, content projection is used to project content in a component. Let’s take a closer look at how it works:
Content projection allows you to insert a shadow DOM in your component. To put it simply, if you want to insert HTML elements or other components in a component, then you do that using the concept of content projection. In Angular, you achieve content projection using < ng-content >< /ng-content >.  You can make reusable components and scalable applications by properly using content projection.


Developing a Web Application Using Angular (Part 4)

In the previous article, we moved one step closer to our working web application by building our service provider layer that acts as an abstraction of our order management web service. With this foundation set, we are ready to complete the last layer in our web application: the User Interface (UI) layer.
Implementing the UI Layer
The first step in implementing our UI layer is to reflect upon the UI design we created in Part 1. In this design, we created two main components: (1) an order list component and (2) a save order component. While the latter component is abstracted into a single component, we are actually designing it to perform two separate tasks: (1) create a new order and (2) edit an existing order. This double-duty derives from the fact that components for creating a new order and editing an existing order look identical, with a few important caveats:


Developing a Web Application Using Angular (Part 3)

In the previous article, we laid the foundation of our implementation by developing the resource layer, including automated unit tests that carefully exercised the functionality of our Order resource class. In this article, we will continue the implementation of our web application by creating the service layer that will interface with our order management web service. Along the way, we will explore the Dependency Injection (DI) and Hypertext Transfer Protocol (HTTP) functionality of Angular.
Implementing the Service Layer
The ultimate purpose of our service layer is to abstract the web service that manages our orders and to allow other components (namely the UI layer) to obtain Order resources and commit changes to these Orderresource objects. In order to accomplish this, we must understand the Representational State Transfer (REST) endpoints that the web service provides and how to interface with these endpoints. As designed in Creating a REST Web Service With Java and Spring (Part 1), our order management web service has the following endpoints: