An easy frontend trick to test Angular2 apps on multiple devices

An easy frontend trick to test Angular2 apps on multiple devices

Photo by Farzad Nazifi on Unsplash

While building an MVP mobile app — it’s a great idea to build out a mobile site first. This gives you an opportunity to lock down on the details of the product before you build out an app.

We use Angular 2 to build out the web app. The same web app can then be packaged into a hybrid mobile app using cordova.

One of the tricks we use to test out things quickly is check the web app on a mobile browser at the same time.

To do this easily we use

ng serve --host=<local IP address>

Then we use at least a couple of mobile browsers pointed at the local IP (after making sure that they’re on the same network). So when you save the file it refreshes not just the desktop but the mobile browsers as well.

This works especially well when using flex — which is a beautiful way to get CSS to work on multiple screens.

Sanat Hegde @Sanat