Nomu S30 review

Nomu S30 review

The S30 is Nomu’s flagship Android phone

The S30 is Nomu’s flagship Android phone, a handset that matches decent speci cations with a tough titanium alloy shell and rubber protection at the corners. It’s waterproof, shockproof, dustproof and it can stand up to extreme temperatures, but is it for you?

Price

The Nomu S30 is a Chinese phone that you can purchase through Chinese sites such as GearBest, where it costs £201 in Black, as per our review model. If you’re happy to get the Silver version, this is a little cheaper at £184.

You should note that upon arrival in the UK you may be asked to pay import duty, which is calculated at 20 percent of the value on the shipping paperwork plus an admin fee of around £11. Also know that your rights when buying goods in China di er to when you are buying products in Europe.

How tough is the Nomu?

The S30 is IP68 rated, which technically means it can withstand being submerged in up to 1.5m of water for up to 30 minutes. However, the company claims it can actually handle up to 5m of water for up to two hours, and that you can take photos and videos underwater or use it with wet ngers (there’s also a glove mode).

However, we found it impossible to interact with the screen while it was wet, and upon close inspection found droplets of water – not enough to cause damage but still concerning – under the back panel strip that conceals the two SIM and microSD card slots.

Although it’s a relatively tight t, there is no rubber seal here to keep out the water. That’s also true of the Micro-USB charging port at the phone’s bottom, which uses a small rubber ap to keep things dry rather than the more attractive and less ddly approach of waterproof phones such as the iPhone 7 and Galaxy S7. The latter, for example, lines the inside of the charging port with rubber and coats the metal with an anti-corrosive substance.

If Nomu really wants its S30 to be seen as a waterproof camera phone it should consider adding a dedicated camera button, since interacting with the touchscreen is impossible without rst drying it.

We like the addition of the waterproof speaker, which is found on the bottom edge and won’t re sound into a desk or the palm of your hand when placed down screen-up. This speaker is pretty loud at the best of times, with Nomu specifying the NXP SmartPA audio chip.

As well as waterproof the S30 is shockproof. During testing we launched it twice across our patio, the resulting damage was merely super cial, with a few scrapes on the carbon- bre-e ect rear and some dents and scu s on the rubber corners and plastic rim around the screen edges (see opposite image).

The screen itself, though, was absolutely ne. This is thanks to Gorilla Glass 4 screen protection, which is pretty tough but not unbreakable. Though the raised plastic rim running the circumference of the screen glass will protect it when dropped on to a at surface, you will only need to drop it to on a stone or the corner of something hard to cause it damage.

Design

It seemed a real shame to have to throw down the Nomu S30 and attempt to cause it damage, because as rugged phones go it’s really not bad looking. It has the same angular rubber corners and chunky body as other tough phones, though the front is all glass and there is none of the garish coloured rubber adorning its exterior.

In fact, the black carbon- bre-e ect rear is stylish, and the rubber is found only at the corners. The titanium-alloy frame is also visible from the sides, held together with small metal screws, which together give it a more premium look than most rugged devices.

The left side button caused us some confusion at rst. The S30 has a huge battery inside – rated at 5000mAh but in our tests we found that when switched o for a few days it wasn’t great at holding its charge. So when presented with a phone that – unknown to you – has a at battery, plus what looks to be a volume rocker and two other buttons, it can be di cult to work out how to turn it on.

For what it’s worth, the power button is the small circular button below the volume rocker on the right- hand side. The other button is an SOS button. The S30 can automatically call and send an emergency help text message to any contact you specify in the settings, though thankfully you’ll need to press and hold the button a few seconds before this will work.

If you’ve no need for the SOS button it can also be used as a shortcut key to launch an app of your choice, though oddly pressing the button won’t wake the screen. So although that app will be ready waiting for you, you’ll need to unlock the phone before you can use it.

Given the SOS button, we’re a little surprised to nd such a weak ashlight. There’s just a single-LED ash on the back of the S30, so even ashing in SOS mode it isn’t going to be easily seen.

LEDs aren’t really the Nomu’s thing, and you’ll nd there’s no noti cation light either.

Something missing from this phone is a ngerprint scanner. That’s not unusual for a rugged phone, though increasingly it will be considered odd by many Android users. If you want to lock the screen you can do so
via a pattern, PIN, password or use voice unlock.

So while the S30 is better-looking than most Android smartphones, there’s no escaping the fact this phone is very large and very heavy, measuring 162x83x13.35mm and weighing 260g. Part of the reason for the extra weight is the aforementioned huge battery, while the extreme size comes down to the 5.5in full-HD screen. This is a very large panel for a rugged phone – the more glass the more chance of them getting broken, of course.

As you would expect there is a lot of space around the screen, helping to ensure any damage at the edges is kept away from the display. These bezels are even chunkier at the top and bottom, and not helped by the touch buttons under the display that could have easily been placed on top of it. Worse, these buttons are overly sensitive, and we kept accidentally pressing them.

All that extra space adds up to a phone screen that’s 5.5in on the diagonal sitting in a body that’s 6.5in on the diagonal. As you can imagine you’ll need big hands to manage this one, and we found nothing in the settings that could ease screen management – the Nomu S30 runs a near-vanilla version of Android 6.0 Marshmallow.

That the screen is so large is not necessarily a complaint, of course. Having a need for a tough smartphone does not automatically rule you out from enjoying luxuries such as videos and gaming that work better with more space in which to play, as we’ll discover in a moment core performance from the S30 is pretty good too.

Nomu has tted a 5.5in Sharp IPS panel, which has a sharp full-HD resolution of 1920×1080 pixels. As we have come to expect from IPS the colours are very realistic and viewing angles strong. We also found the S30 su ciently bright for use in all conditions, making that screen a de nite point in its favour.

Performance

In the past buying a rugged phone has so often meant compromising on performance, but not here. The S30 is not the fastest phone money can buy, but with the Helio P10 chip inside it o ers decent mid-range performance that should suit all but the most demanding of users.

The Helio P10, also known as MediaTek’s MTK6755, is here clocked at 2GHz and has integrated ARM Mali-T860MP2 graphics running at 700MHz. This chip is paired with a very healthy 4GB of RAM, though you should note this memory is of the slower LPDDR3 variety than the LPDDR4 we so often see in agships.

There’s also a decent amount of internal storage, at 64GB, and you can bolster this with support for microSD. Unfortunately, the S30 can accommodate cards only up to 32GB in capacity, but in total that’s a not-insigni cant 96GB, and we especially like the fact this dual-SIM phone doesn’t force you to choose between adding a second SIM or removable memory.

All in all that’s some pretty decent core hardware for a £200 tough phone, and it shows in our testing.

In real-world use we found no sign of lag in navigating menus and launching apps, and the S30 performed admirably in our benchmarks, with a similar performance to devices such as the Meizu M3 Max and Ulefone Future.

In Geekbench 4 we recorded 705 points single-core, and 2,851 in multi-core mode. We also ran the Nomu through AnTuTu 6, and recorded 51,827 points.

For graphics testing we use GFXBench, and in the T-Rex component the S30 managed a playable 17fps. In the more intensive tests it scored 7fps in Manhattan, 5fps in Manhattan 3.1, and 3fps in Car Chase.

The JetStream JavaScript benchmark also clocked the Nomu S30 at a pretty average 26.085.

Battery performance is where the Nomu S30 really excels, as you might expect given the 5000mAh battery inside. You should easily get two days’ use from this smartphone, and more depending on your usage.

Nomu says the S30 can endure 30 hours of talk time and 70 days on standby. In our testing we found the battery struggled to hold its charge through extended periods switched o , though this may be an issue unique to our review sample.

Unsurprisingly there’s no support for wireless charging, but the S30 does support fast charging. PumpExpress 3.0 can o ers charging speeds up to 45 percent faster than traditional chargers, allowing you to obtain four hours of talk time from a ve-minute charge.

Connectivity

We touched upon the fact this is a dual-SIM phone earlier, which is something very common in the Chinese market. The S30 will accept two Micro-SIM cards, and it will then operate in dual-standby mode. This means both SIMs are active at all times, able to send and receive calls and texts, but only one can be used for data and, naturally, you can receive only one call at a time.

The Nomu S30 o ers 4G LTE Cat 6 connectivity, and in the UK it supports all three 4G bands – 800-, 2100- and 2600MHz. If you reside elsewhere, check out how to tell whether a phone is supported by your network.

The connectivity speci cations are standard-fare, with dual-band Wi-Fi, Bluetooth 4.0, NFC, GPS, A-GPS and GLONASS, and OTG. The phone also features a 3.5mm headphone jack and a Micro-USB port for charging and data transfer.

Cameras

The S30 might not be top of your list for devices on which to take beautiful photo masterpieces, but whether you’re using it at work or during extreme sports you will likely nd many occasions in which it becomes useful.

We have to say we’re not massively impressed with the phone in the photography department, but even if it isn’t the best in the business it still does a better job than many phone cameras.

At the rear you’ll nd a Sony IMX214 camera, which supports phase-detection autofocus and has a f/2.0 aperture. The camera also supports 1080p video recording, and it paired with a single-LED ash that makes the Nomu no good for night-time photography.

Contrary to what we were expecting, the autofocus is very slow, which makes the issue even more obvious in our HDR shot. On the plus side, we found the colours very true. The Sony IMX214 is a 13Mp camera, but by default in the S30 it has been interpolated to 16.4Mp. You can switch this back to 13Mp in the camera settings, but as we take all our test shots in ‘out of the box’ fashion we did not. It’s a similar deal with the front-facing sel e camera, which is rated at 5Mp but boosted to 8Mp in the software. The preinstalled camera app is basic, o ering Panorama and Picture in Picture modes, HDR, a selection of real-time lters and a 40-shot burst mode. There is no Beauty mode even for the sel e camera.

Software

The S30 runs a vanilla version of Android 6.0 Marshmallow out of the box. Oddly, when we signed into our Google account we received a noti cation from Google asking whether we had just signed into a Cat S30 phone, though the two are di erent.

Almost everything looks and acts the way you would expect in standard Marshmallow, though there are a few additions to the Settings menu. The most notable of which is controls for the SOS button we covered earlier in this review, but you’ll also nd some gestures.

These include options to wake the screen with a double-tap, and non-customisable quick launch controls for the camera and calculator, which can be accessed by drawing either a C or a V onscreen in standby mode. Though these are not customisable, you can set your own actions for the letters E, M, O, S, W and Z. We don’t know what happened to the rest of the alphabet. Also here are the ability to take three- nger screenshots, or to open the recent apps menu by sliding three fingers up the screen. You can also ip to mute.

Verdict

The Nomu S30 passed our durability tests with only super cial damage. It has a large, bright screen, and decent performance for most users, but falls down on its camera quality, size and weight.

Specifications

5.5in full-HD (1920×1080) Sharp IPS display with Gorilla Glass 4

Android 6.0 Marshmallow n IP68 waterproo ng
Shockproof case
SOS button

2GHz MediaTek Helio P10 (MTK6755) octa-core chip n 700MHz ARM Mali T860MP2 GPU
4GB LPDDR3 RAM
64GB storage, microSD support up to 32GB

dual-SIM dual-standby (2x Micro-SIM)
4G FDD-LTE Cat 6 800/900/1800/2100/2600MHz n dual-band 802.11a/b/g/n Wi-Fi
Bluetooth 4.0
GPS
A-GPS
GLONASS
NFC
OTG
3.5mm headphone jack
13Mp Sony IMX214 f/2.0 rear camera
5Mp front camera (software boost to 8Mp)
5000mAh non-removable lithium-polymer battery , claimed battery life 30 hours talk time, 70 days standby n PumpExpress 3.0 Quick Charge
Micro-USB
162x83x13.35mm

260g

Moto G5 Plus

Moto G5 Plus review

Lenovo’s Motorola Mobility

Lenovo’s Motorola Mobility used MWC 2017 to show o its new Moto G5 and Moto G5 Plus, which are brilliantly priced smartphones that o er some of

the features of its agship but without the cost.
We spent some time with both devices on the show oor to give you a closer look at the new smartphones and over our initial thoughts about them. Here, we bring you our hands-on review of the Moto G5 Plus.

Design

This is a good-looking phone that manages to stay compact despite its 5.2in display. That’s smaller than the previous G4 Plus’s 5.5in display and is an unusual choice considering the much cheaper G5 has a 5in display.

The G5 Plus measures 150x74x7.7mm and weighs 155g, which is suitably thin and light and felt comfortable to hold, particularly thanks to its slightly rounded back and edges. That’s also signi cantly thinner than the G4 Plus’s 9.8mm, but keeps the same weight.

Unlike previous models of the G range, Lenovo has opted for a metal body to add a more premium feel to the smartphone, and it is available in stylish Lunar Grey or Fine Gold colour options. We like the circular, centralized camera housing on the rear of the phone, too.

Features

The G5 Plus’s display is Full HD and made with Gorilla Glass 3, and we found it to be bright and crisp during our testing, although of course not quite as outstanding as the agship Moto Z’s Quad HD o ering and other agship rivals.

Inside the Moto G5 Plus is a Qualcomm Snapdragon 625 2GHz octa-core processor with Adreno 506 graphics, which should mean reasonably speedy performance for a mid-range phone but it might struggle with some heavy- duty tasks and graphics-hungry games.

It didn’t lag at all during our testing, even when switching between apps and launching the camera, but we’re looking forward to getting the G5 Plus back to our lab to test its speed fully.

That chipset is paired with 3GB RAM in the UK, and there are 2GB and 4GB con gurations available for US customers. We’ll get 32GB built-in storage with the ability to add up to 128GB via microSD card. In the US, there’s also the option of a 64GB model, but it doesn’t look like that’s coming to the UK.

We’re particularly interested to see just how much better the performance is compared with the G5, which costs £80 less than the G5 Plus. The main di erences between the G5 and G5 Plus are the tiny increase in screen size (the G5 has a 5in screen compared with the Plus’s 5.2in), the more powerful processor and its better camera, so comparing them is going to be key to our nal verdict because that’s no small price di erence.

The Moto G5 Plus’s rear camera o ers an improvement over its smaller sibling but not when it comes to megapixels. It’s a 12Mp snapper compared with the G5’s 13Mp, but with Dual Autofocus Pixels for a sharper image and speedy focusing. It also has a large f/1.7 aperture and bigger pixels to let in more light in darker conditions.

“I enjoy the alternate Friday and Saturday study format as I work in London. I have the exibility to manage my job and studies.” Rashmi Jain, Executive MBA (London), Business Project Manager, IBM

The front-facing camera is the same though, at 5Mp with a wide eld of view and an f/2.2 aperture. It has its own ash, too.

When it comes to video, the G5 Plus can capture 4K Ultra HD (and improvement over the G5’s 1080p full HD).

There’s a 3000mAh battery that Lenovo claims will last all day, and there’s TurboPower charging too to allow you to give the smartphone up to six hours of battery power in just 15 minutes.

You’ll nd 4G LTE connectivity and Bluetooth 4.2, and it charges via Micro-USB.

Software

The Moto G5 Plus runs Android 7 Nougat with Moto experiences, which include Moto Display and Moto Actions. Moto Display lets you see a preview of your noti cations and updates without requiring you to unlock your phone to let you decide whether you need to take action now or leave it for later.

Moto Actions, on the other hand, lets you access apps much quicker with a simple movement or gesture. You could open the camera by twisting your wrist, for example, or chop down twice to turn on the torch.

But what we really loved was the ability to use gestures on the ngerprint sensor to go back or open multi-tasking, which means the company has been able to do away with the physical or capacitive back and multi-tasking buttons you’d usually nd anking the home button on an Android device. That in turn means the device manages to be more compact, but better yet we found it incredibly intuitive to use. In fact, it’s one of our favourite features on the Moto G5 Plus.

It comes complete with Google Assistant, too, which means there’s even more that can be done on the phone much more quickly than ever before.

Verdict

Overall we’re really impressed by the design of the Moto G5 Plus and the specs are good considering the price tag, but we’d still consider opting for the G5 instead. It’s a whole £80 cheaper and we’re not sure the extra power and improved camera are worth that extra cash. The 0.2in di erence in screen size is hardly noticeable, either. That’s not to say this isn’t a good mid-range phone, though. It can certainly compete with the Galaxy A3 and the Nokia 6, but so can the Moto G5 with that lower price. It’s a tricky one to recommend when its smaller and cheaper sibling is so great.

Specifications

5.2in (1920×1080, 424ppi) touchscreen
Android Nougat 7.0
2GHz Qualcomm Snapdragon 625 octa-core processor
Adreno 506 graphics
3GB RAM
32GB storage
12Mp main camera, dual-LED ash, support for

4K video at 30fps
5Mp front-facing camera
Bluetooth 4.2
4G LTE
Nano-SIM
GPS
3000mAh non-removable battery n 74×150.2×7.7mm
155g

Honor 8 Pro

Honor 8 Pro review

Honor is technically a start-up

Honor is technically a start-up, but it exists as part of Huawei, the huge telecoms brand that has itself moved successfully into the smartphone

business in recent years. The 8 Pro is the latest phone to use Huawei hardware and software under Honor’s cheaper branding.

Does this make it inferior? What is clear from the o is that this is a change of gear for Honor; the 8 Pro is the highest spec phone its ever released, and it’s incredibly fast and powerful. It’s just that it doesn’t feel any more than the sum of its parts.

Design

This is hands down the most premium Honor phone ever and is actually the European version of the Chinese released Honor V9. It trumps a fair few Huawei phones too. Rather than opt for the Honor 8’s glossy rear panel, it uses brushed aluminium that is way more ngerprint- friendly (in other words, you won’t really see them).

The generous 5.7in display sits in a relatively slim bezeled device, but it’s pretty hard to use one-handed. I’ve got small hands, but compared to the slimness (and same screen sized) LG G6, it feels oddly antiquated.

That isn’t a slight on this phone speci cally, it’s more indicative the malaise of the last few years of smartphone design, and now that we have the G6 and Galaxy S8, other still-excellent phones simply look less enticing.

Having said that the 8 Pro is a smooth operator, with a static rear mounted ngerprint sensor, subtle aerial lines and a USB-C port on the bottom next to the mono speaker and a 3.5mm headphone jack. The right side has the standard volume rocker and power/ lock key.

There’s also a dual SIM slot on the left edge that you can alternatively use one SIM and a microSD card with.

My review unit of the 8 Pro is a tasteful navy blue – better, I think, than Google’s incredibly blue Pixel. The front is Gorilla Glass 3, and in a smart touch there is aluminium reinforced glass covering the rear-facing dual cameras.

These cameras pleasingly sit ush with the slim body of the device, great to see on a phone approaching high- end. But what is high-end? Is it price or specs, or both?

Extra detailing on the 8 Pro such as the textured power button and diamond cut bezels show an attention paid to design that is often lacking in Honor phones (and a fair few others in general).

The phone feels quite like an iPhone 7 Plus in the hand, despite its screen being larger than that device’s. The 8 Pro is fairly weighty, and I often reverted to do everything on it with both hands.

The 8 Pro is one of those phones you pick up and immediately know if it’s your bag or not. For me, it’s a shade too big for my hands, but if you like phablets and excellent build quality (with a splash of blue) it’s every bit as premium as a Huawei agship like the P10 Plus. Which is quite an achievement.

Hardware

The speci cations themselves are impressive. The marketing says the Honor 8 Pro is ‘born for speed’. It’s corny, but it’s not far from the truth.

Processor

It is a surprise that the 8 Pro has the high-end Huawei Kirin 960 processor, the same one found on the rm’s P10 and P10 Plus. Those phones are more expensive, but with the same chipset in the 8 Pro, it really can compete with those phones, commercially and technically, and all at a lower price point.

Storage and RAM

It’s available with 64GB storage but is expandable to 256GB via microSD, or you can opt for dual SIM. Like the OnePlus 3T it has 6GB RAM, which is still a bit nuts, but paired with the processor gave us insanely high benchmark results.

The 8 Pro knocked out a ridiculously high score in the Geekbench 4 single and multicore tests. At the time of writing, it was the highest score we’ve ever seen on the platform, and that is impressive for a £475 phone. Almost (almost) unbelievably so.

Display

The phone measures 157×77.5x7mm, amazingly thin for a phone with a large 5.7in quad HD display and resolution of 2560×1440. It’s the rst Honor phone in the UK to have a quad HD screen, and it looks good – but put it next to the Huawei P10 with brightness on a white screen turned up and it looks a tad grey and duller.

Games, battery benchmark test videos, Net ix and more all look pretty great on the display, and only the pickiest of consumers will have qualms with it. Honor’s colourful software choice in the default wallpapers and icons do it justice, and as long as they’re your thing too, you won’t mind. The display over saturates colours, but this is by design. It’s kept more resilient with the use of Gorilla Glass 3.

Cameras

It’s good to see a dual camera set up on the Honor 8 Pro in a year where the LG G6 is reminding me why it’s such a good idea. The latter’s has an excellent wide-angle mode, and while that is lacking on the 8 Pro, there are some bene ts to be had with f/2.2 aperture.

The dual lenses mean you can choose to shoot in wide aperture, cleverly taking images on three planes of vision to digitally render the best possible exposure from your snaps. The level of detail on landscapes and macro shots was pleasing.

The cameras also mean zoom quality is top notch. A neat addition is ‘Ultra snapshot’, which takes a picture with double press of the volume down key when the phone is locked. It’s a good idea, but results are generally a tad burred despite the lenses supposedly being able to quickly focus on the intended subject.

The 8 Pro can also shoot video at 1080p at 60fps, which is to be expected these days, and results were as expected. The 8Mp front-facing camera is a standard a air, but will serve every purpose you throw at it from sel es to Skype. And yes, Huawei’s weird beauty mode is still here to take all the detail away from your face.

Connectivity and extras

The standout extra on the 8 Pro is actually the box it comes in. Honor has cleverly turned it into a VR headset much like Google Cardboard, and it’s pretty good. Sliding the view nder out the box, adding lenses to the eye holes and putting the phone in it is an immediate VR experience, and works well with the included Jaunt VR app.

Other apps are downloadable and it’s good to see Honor pushing VR to consumers for free. This is the only surprise, and are joined by USB-C, Bluetooth 4.2, NFC and everything you’d expect to nd on a smartphone just shy of £500.

Software

The 8 Pro runs Android Nougat 7.0 with the EMUI 5.1 skin. 5.1 is less intrusive and more re ned than the EMUI of old, but it still remains a level below the experience to be had on Samsung’s TouchWiz or OnePlus’ OxygenOS (and stock Android, of course). It’s not unattractive, but the sometimes-confusing menus and over elaboration make the phone feel a little limited, even when it isn’t; it’s still a bit on rails.

You can add an app tray rather than have iOS- like apps all over the home screen and there are little touches which we noticed, like highlighting the rst app beginning with the letter you just scrolled past when they’re ordered alphabetically with a little raise.

The EMUI apps for calendar, messaging and gallery (and more) are excellent though, pleasantly plain, clean cut and preferable to use, within the EMUI software, over the Google alternatives, which is something I can’t say for every high-end Android handset out there.

You get the usual bloat with Honor, but it’s easily ignored if you don’t want it (you don’t). The best additions are stu I mentioned such as the ultra snapshot mode, good processing of images taken with the dual lenses and the fact EMUI 5.1 is a vast improvement.

Verdict

I only had a few days with the Honor 8 Pro, but it’s a promising device. It represents the brand moving even closer in look and price to big brother Huawei, but it remains a decent option. However, without contract options in the UK at this time, you’ll have to plump for SIM free, and at just under £500 you might be tempted to look at the OnePlus 3T or even go for a more expensive, better phone on contract.

Specifications

5.7in quad HD (2560×1440, 515ppi) touchscreen n Android Nougat 7.0 with EMUI 5.1
Octa-core Kirin 960 processor
Mali-G71 MP8 GPU

6GB RAM
64GB storage expandable to 256GB with microSD
Dual nano SIM compatible
12Mp dual cameras, f/2.2, LED ash, support for 2160p video at 30fps
8Mp front-facing camera
802.11 a/b/g/n/ac Wi-Fi
Bluetooth 4.2
4G LTE
GPS
NFC
4000mAh non-removable battery n 157×77.5x7mm
184g

Samsung Gear VR

Samsung Gear VR

Samsung’s Gear VR is a VR headset that wraps around its Galaxy phones, allowing owners to experience high-quality VR without the expense of specialised rigs like the Oculus Rift or the HTC Vive (and the PC required to run them) or the PS VR and PS4.

New phones require Samsung to produce a new

Gear VR to t around them, and so it is with the rather Galaxy S8 and S8+ phones. The latest Gear VR isn’t much di erent from the previous model, but there’s now a separate controller that makes a radical di erence to how you use it, and what experiences you have with it.

Samsung has also created a new portal and app with lots more videos and games.

In action

I had a short amount of time to try out the Gear VR with a Galaxy S8+ during a small launch party in Shoreditch following the grand unveiling in Stratford. We’ll provide a full review when we get to spend more than 30 minutes with one and aren’t trying to evaluate it after the warming e ects of a couple of very well made gin and tonics.

The idea of – essentially – strapping a phone to your face to experience virtual reality may seem a little odd, but 2017’s Gear VR does feel comfortable – even on my freakishly oversized head and large glasses. As well as tweaking the design to allow the S8 or S8+ to t inside, Samsung’s designers have made it t to your head more snugly without feeling too tight.

Adjusting it to your head size is easier than with the HTC Vive, and the Gear VR is noticeably lighter too, so you can use it for longer without getting neck ache.

I didn’t get a chance to see how easy it was to pop in and out the phone, but it looked relatively easy – and the phone stayed securely in place despite me whipping my head around to nish o one last zombie (which I’ll get onto later).

The first experience I tried was Rilix VR – a short rollercoaster ride set in a rickety old mine with creaking beams and broken tracks (and more lava than you’d probably want in your workplace). I’ve seen this so many times I could probably play in back in my head without wearing a headset, but it’s fun nonetheless (unless you su er from vertigo).

The high-resolution (2960×1440) screen of the S8+ (or the standard S8) means that the virtual (under)world looked clear and crisp. I didn’t look obviously better than when I saw it before, though. The S8/S8+’s resolution is 400 pixels wider than the S7, but as these are out in your peripheral vision, it might not make any real di erence. We’ll investigate more when we get a review unit.

Gear VR 2017 vs Google Cardboard

However, if you’ve only tried VR through Google Cardboard before, the Gear VR is smoother and the head-tracking feels much more accurate – and it’s more comfortable, especially compared to those throwaway ViewMaster-style viewers.

The real di erence is the controller. Somewhere between a Wii Controller and a laser pointer – or a “modern discreet sex toy”, as another attendee described it – it’s small, light and easy to use.

There’s a big touchpad-cum-button on the top, with a trigger underneath. Along the top of the shaft you grip by are volume controls, home and back buttons. The layout seemed easy to use and quick to learn, though the single game I got to play with it only used the trigger.

Drop Dead is a stand-there-and-shoot zombie game whose gameplay will feel instantly familiar to anyone who’s played similar shooters on the Oculus Rift or
HTC Vive – or the Nintendo Wii, or any lightgun-based shooter back to Operation Wolf in the arcades.

You look around, zombies appear, you point your gun (in other words, the controller) at them and blast until they drop. If you run out of ammo, you point down to reload. If they get too close, you lose health. Lose too much and it’s game over, man, game over.

Drop Dead is an equivalent to Wii Sports – a really good intro to the Gear VR, especially if you’ve never played a VR game before. You can learn Drop Dead quickly and be moderately good at it soon after – and its cartoonish graphics won’t scare you too much.

However, it’s not a great example of what the Gear VR and controller is capable of, or how easy it is to use for more complex games or experiences. It’s early days for the platform though, so hopefully in time we’ll see how it compares to other VR systems with controllers such as the Rift or Vive.

Gear VR 2017 vs Oculus Rift & HTC Vive

Watching videos on the Oculus Rift or HTC Vive isn’t really any di erent to the Gear VR, though games and other CG-based experiences are much higher quality on the Oculus and HTC’s headsets. This is less to do with the resolution of the screen/s but the processing power of the S8 vs a full-spec gaming PC.

The other key di erence is that you get two controllers with the Rift and Vive, and the latter also tracks you as you walk around.

But the power of the Rift and Vive are also their weakness. Tethered to PCs, they are a serious commitment – not only in cost, but in the time it takes to set them up. You can use the Gear VR anywhere.

Verdict

It’s too early to pass judgement on the new Gear VR. If you’re seriously into VR videos and/or you’re buying a Galaxy S8 or S8+, it’s an obvious choice, though sadly here in the UK you won’t get it for free with an S8 or S8+ like you will in the US. If you’re after games, you’ll have to wait to see what developers build that takes advantage of the controller – though from the look of Samsung’s new VR site, it’s making a major investment in VR content. So here’s hoping that it lives up to the platforms potential.

Samsung Galaxy S8+ review

Samsung Galaxy S8+ review

Design

This year there’s not a huge di erence between Samsung’s two agship phones. As they both have an edge screen display, the handsets are simply di erent sizes when it comes to design – hence the Galaxy S8 and S8+ naming system with no ‘edge’ element.

The Plus model isn’t vastly bigger than the regular Galaxy S8. It’s around 10mm taller and 5mm wider, which isn’t much to jump from a 5.8- to 6.2in screen (see below). It’s astonishing how normal these phones feel in the hand considering those gures. Bear in mind that the S8+ is heavier at 173g compared to 155g.

You’ll notice that a big di erence in this year’s Galaxy phone is the impressive screen-to-bezel ratio and the rounded corners of the display which match the metal frame. To make this happen, Samsung has ditched the traditional section below the screen for home button.

The ngerprint scanner has been moved to the back – slightly awkwardly next to the camera rather than below it – and there’s a pressure sensitive home button built into the display.

You get all the same design features as the smaller model including a headphone jack, Gorilla Glass 5 rear cover and IP68 rated waterproo ng. A new button sits on the left for launching Bixby – more on this in the software section.

In the UK, Samsung is o ering the Galaxy S8+ in three colours: Midnight Black, Orchid Grey and Arctic Silver. The blue and gold options will launch in other markets such as China but may come to the UK at a later date. We like all the colours, but be warned that the Arctic Silver option is very shiny, almost mirrored like the Sony Xperia XZ Premium. Samsung has said this colour will be available ‘in due course’, so the black and grey options will be the choices to start with.

Features

Samsung likes packing as much tech into its phones as humanly possible and the S8+ ticks almost every box you could think of for a agship phone.

Display

As you’ve gathered already, the screen size is the big di erence between the S8 and S8+. Both phones now have Samsung’s edge screen technology so there’s no longer the need to buy the larger option to get this.

The rm has tweaked the edge display though, so it’s not as exaggerated this time. You still get the edge panels, but you can’t use the edge to show
the clock at night and show other information like previously. Your decision, then, is whether to go for the smaller 5.8in model or the 6.2in version. These sizes sound a bit ridiculous, but the S8+ is only really a little bit taller than the Galaxy S7 edge thanks to the tiny bezels.

It’s best to try both in the hand before you commit, but we feel the regular Galaxy S8 will be enough for most consumers. The 0.4in doesn’t make a huge di erence in use, although the ‘+’ model does bene t from a larger battery – see below.

In terms of speci cations the Galaxy S8+ uses the same Super AMOLED technology as the smaller model and has the same Quad HD (2960×1440) resolution. This means a lower but insigni cant drop in pixel density from 570- to 529ppi.

Similar to the LG G6, the S8+ has an unusual aspect ratio. Instead of the typical 16:9, it’s 18.5:9, so the screen is very tall. This makes watching video a much better experience as you don’t get annoying black bars. When a video is displayed full screen, you’ll need the pressure-sensitive home button.

Processor

Like the regular model, the Galaxy S8+ will come with two di erent processors for di erent markets.

We believe that the UK model will come with Samsung’s Exynos Series 9 8895 chip based on the clock speeds we have been given – 4x 2.3GHz and 4x 1.7GHz. Those don’t match up with the Qualcomm Snapdragon 835 that Samsung co-produced so we expect this to be the platform for other markets.

We’ll benchmark the Galaxy S8+ when we get a nal sample but we were impressed during our couple of hours of hands-on time.

Memory and storage

Samsung has kept things simple this year, so the Galaxy S8+ matches the smaller model with 4GB of RAM and 64GB of storage. As usual, there’s expandable storage, so it’s easy to add a further 256GB with the microSD card slot. It’s a bit of a surprise to hear nothing about a larger storage capacity, but we wouldn’t bet against a 128GB option coming at a later date. For now, though, there’s no head scratching to be done on the subject

– it’s 64GB or nothing.

Connectivity

Want top-notch connectivity? Well how does dual-band 11ac Wi-Fi, NFC, GPS, Bluetooth 5.0 and LTE Cat 16 sound for starters? Furthermore, the Galaxy S8+ comes with a reversible USB-C port and the usual heart rate monitor. It’s all the same as the S8.

Fingerprint and Iris scanners

As you can see in the image on page 20, the ngerprint scanner has been moved to the back of the phone in order to have such a large screen with small bezels.

This isn’t something new, but most rivals place the scanner below the camera. Instead, it has been put to the side meaning right-handed users will have to reach across the lens to use it. Smudging the glass isn’t ideal but Samsung thinks users won’t use it as much. That’s because the Iris scanner introduced on the Note 7 has been improved, so you can look at the phone to unlock it. We haven’t tried it ourselves, but in demonstrations

it appears to be pretty fast. Not everyone wants to hold a phone up to their face to unlock it though, so we’d rather Samsung had opted for ergonomics over design symmetry for the ngerprint scanner.

Cameras

Phone photography is important to almost every user and Samsung has upgraded the front camera to 8Mp (from 5Mp) for sel e fans. It still has an f/1.7 aperture and after a quick play with it, things look promising.

The Galaxy S7 range has an awesome camera and Samsung hasn’t felt the need to make any changes.

It’s a 12Mp Dual Pixel camera with an f/1.7 aperture, optical image stabilisation (OIS), 4K video recording
and an LED ash. We’ll test this out for our full review, but going by the S7, the S8 is likely to be one of the best phones on the market for cameras. With such a large screen, the camera app has been tweaked to make it easier to use with one hand. You can do things such as zoom, switch between cameras and modes easily.

Battery life

Apart from the larger screen, there’s another reason
to opt for the Galaxy S8+ over the smaller model. It still has USB-C, fast charging and wireless charging but since the device is bigger there’s more room for a battery. While the S8 has a 3000mAh battery, the S8+ is larger at 3500mAh.

Software

Phone software isn’t particularly exciting these days, especially considering the hardware on o er. However, Samsung has a few interesting bits and pieces going on when it comes to the Galaxy S8+.

Android 7.0 Nougat

It’s no surprise that the Galaxy S8+ runs on the lasted version of Android, 7.0 Nougat, and Samsung kept things mostly simple and intuitive. There are a large number of preinstalled apps, but not the kind of ones most will want to delete including the Google ones you’re used to on Android, Microsoft apps and Samsung’s own. One of the big Nougat tweaks you’ll have to get used to is swiping upwards to access app draw, rather than tapping an icon.

Snap Window

A new feature to help you deal with, and make use of, the larger screen is Snap Window which is a new element to Multi Window. Using a new icon when viewing recent apps, you can select a portion of an app to pin at the top of the display while you carry on using the remainder like normal.

Bixby

Bixby is a new digital assistant along the lines of Siri and Google Assistant you can instantly access with the dedicated button on the side. Samsung says you don’t need to know what phrases you can and can’t say, and the software will understand the context of what you’re doing in order to help better. It can also do cool things with the camera such as recognize and provide information for landmarks and products. We’re not totally convinced yet as Samsung, of course, only demonstrated things it could de nitely do and much of the functionality has already been available via rivals. Google Assistant is on the Galaxy S8 and you’ll need to use this for a while anyway as Samsung is only making Korean language available for Bixby at launch followed by US English in May.

Until UK English arrives, hitting the button or swiping right from the home screen will launch Bixby Home which is similar to Google Now.

DeX

Along with the latest Gear VR headset and the Gear 360 2 camera is an interesting docking station for the Galaxy S8 called DeX. The dock allows you to use a desktop-style interface on a monitor with a keyboard and mouse just by plugging the phone in. You can use apps in di erent windows and Samsung’s browser will request desktop versions of websites so you get the full experience.

The dock itself features USB-C to connect the phone and then o ers two USB ports, Ethernet, HDMI and a cooling fan. You can also use a wireless keyboard and mouse if you like.

Verdict

As with the regular Galaxy S8, we’re impressed by the S8+. Samsung has done a great job of making last year’s models even better. However, our initial thought is that, with both o ering the in nity edge screen, there’s not much reason to spend an extra £90 unless you want a slightly bigger screen and larger battery.

Specifications

6.2in Quad HD display (2960×1440), 529ppi n Android 7.0 Nougat
Exynos 8895 octa-core processor
4GB RAM

64GB internal storage
MicroSD card slot (up to 256GB) n 12Mp rear-facing camera with OIS n 8Mp front camera
Fingerprint scanner
11ac dual-band Wi-Fi
Bluetooth 5.0 with aptX
NFC
4G LTE Cat 16
Headphone jack
USB-C
3500mAh non-removable battery n Wireless charging
IP68 dust and waterproof rating
159.5×73.4×8.1mm
173g

Samsung Galaxy S8 review

Samsung Galaxy S8

Design

If the Galaxy S7 was stunning in design then we’re not exactly sure how to describe the S8 apart from that it’s on another level.

Samsung has brought its edge screen technology to both phones this year so you don’t need to buy the larger Galaxy S8+ to get the full experience. This not only looks great but has a big advantage when it comes to keeping the size of the phone from getting out of control.

The S8 is pretty much the same width, thickness and weight compared to its predecessor. It’s just a few millimetres taller but jumps from 5.1- to 5.8in when it comes to screen size. So what would typically be an unwieldy device feels barely any different in the hand. It’s a really impressive piece of craftsmanship, largely down to signi cantly reducing the bezels at the top and bottom. The physical home button and accompanying capacitive keys are gone to achieve this. Now you have on-screen navigation and a pressure sensitive home button built into the display.

The fingerprint scanner is now on the back, though awkwardly next to the camera rather than below it, and right-handed users are likely to smudge the camera when using it. Samsung has, however, improved the Iris scanner, so you might not nd yourself needing it.

A lot of users will be pleased to hear that Samsung has retained the headphone jack on the bottom. The Galaxy S8 is made from a lot of glass once again so it’s a little slippery but has a Gorilla Glass 5 back to resist damage.

As you’d expect, the Galaxy S8 is fully dust and waterproof like its predecessor, so has an IP68 rating. That extra button you see on the left side of the phone is to quickly launch Bixby (page 11), Samsung’s arti cial intelligence assistance.

There are ve colours to choose from, but in the UK we’ll get three at launch: Midnight Black, Orchid Grey and Arctic Silver (the latter with arrive at later date). Samsung may well bring the blue and gold options at the later date but we’ll have to wait and see.

Hardware

Compared to the Galaxy S7, the new S8 isn’t dramatically di erent when it comes to the speci cations and hardware on o er. That’s partly because the S7 ticked a lot of boxes, but there are new components with the screen being the most obvious change.

Display

As mentioned in the design section, Samsung has impressively jumped from 5.1- to 5.8in when it comes to screen size. This is despite the phone only being
a little taller in shape. If that’s not big enough, the Galaxy S8+ is a whopping 6.2in.

Like the LG G6, the Galaxy S8’s display had rounded corners which look great, matching the curvature of the phone’s metal frame. Samsung has also opted for a similar aspect ratio of 18.5:9 meaning the screen is very tall (or wide in landscape).

You can t more on the screen, of course, and the aspect ratio suits content like videos much better, so you don’t have to watch videos with annoying black bars any longer. Samsung has also added various software elements to ensure comfortable one-handed use.

The smartphone maker has stuck to its preferred SuperAMOLED display technology ensuring great contrast and colours. The S8’s screen resolution is Quad HD, 2960×1440 in this case because the screen is so tall. A pixel density of 570ppi is enough for anyone.

Specifications aside, the S8 also now has the well known edge screen as standard, so there’s no need to buy the edge version any longer (like the Galaxy S7 edge). The curve is more subtle than previous edge devices though, so you just have the edge panels rather than
any other additional functionality.

Processor

Once again, the Galaxy S8 will have a di erent processor for di erent markets around the world. Samsung has been a bit vague on the subject, but it appears the UK model will have the rm’s new Exynos 9 8895 chip rather than the Qualcomm Snapdragon 835 the two companies collaborated on. We’re assuming this as we’re told the Galaxy S8 will have an octa-core processor with clock speeds of 2.3- and 1.7GHz (four cores each) which doesn’t match up with the specs of the Snapdragon 835.

What we can say at this stage is that the Galaxy S8 felt very smooth indeed during our hands-on time with it. We’ll test this further along with benchmarks as soon as we get a final review sample.

The firm claims a 10 percent increase in CPU performance and a 20 percent gain on the GPU side.

Memory and storage

Not a huge amount has changed in this department but here’s the deal. The S8 still has 4GB of RAM and comes with 64GB of storage as standard. Samsung hasn’t mentioned anything about a 128GB model but that could come later.

As usual, the phone has expandable storage, so you can add up to 256GB via the microSD card slot.

Connectivity

As you’d expect from a agship Samsung phone, the S8 is packed with all the latest connectivity speci cations. To this end, it has dual-band 11ac Wi-Fi, NFC, GPS, Bluetooth 5.0 and LTE Cat 16. It also uses a reversible USB-C port like recent Samsung devices and rivals.

The heart rate monitor also remains but has been moved to the other side of the camera module.

Fingerprint and Iris scanners

As mentioned already, the ngerprint scanner has moved to the back in order to t a much larger screen. We’re all for this – LG has been doing it since the G2 – but the placement isn’t very ergonomic.

Samsung appears to have prioritised the symmetry of design over functionality here, so most users will be making the camera lens grubby when reaching for the sensor. We haven’t tested the scanning itself, but we’ve seen it in action and it’s fast. You can also unlock the phone with it without the need to wake it up rst.

Luckily, the ngerprint sensor isn’t needed as much with the Galaxy S8 because Samsung has improved the aky Iris scanner found on the Note 7. Again, we haven’t tried it, but it works very quickly if you can be bothered to hold the phone up to your face.

Cameras

There’s no change from the fantastic camera inside the Galaxy S7. So the S8 has a 12Mp Dual Pixel snapper with an impressive f/1.7 aperture and other features such as optical image stabilisation (OIS) and 4K recording.

The camera o ers ‘multi-frame image processing’ where it takes three shots instead of one and uses the extras to do things like reduce blur and perfect other elements like focus.

If the S7 is anything to go by then the S8’s camera will be one of the best available on a phone. It certainly seemed very decent during our time with it, but we need a lot longer to give you a proper verdict.

When it comes to the front camera things are similar with a matching f/1.7 aperture, though the resolution has been bumped from 5- to 8Mp. Again, during hands-on testing this camera outputs good quality results, but we’ll test this further.

If you’re worried about jumping to a much larger screen size Samsung has made tweaks to help you operate the phone with one hand. In the camera app, we found it easy to switch between the cameras, modes, lters and even zoom all with di erent thumb swipes.

Battery life

Samsung hasn’t made a big song and dance about battery life on the S8. This may be partly due to the fact it has the same 3000mAh capacity as its predecessor. Nevertheless, it’s good to see features such as USB-C, fast charging and wireless charging all as standard.

It’s likely that most users will need to charge the S8 every night, but we’ll know more once we’ve had the phone for a signi cant period of time.

Software

Manufacturers don’t typically sell phones on the software, and this is largely the case with the S8, but there are some interesting things to talk about.

Android 7.0 Nougat

As you’d expect, the phone comes preloaded with the lasted version of Android, 7.0 Nougat and Samsung hasn’t mucked about with it too much. The interface remains clean and easy to use, but still has lots going on behind the scenes. You get a lot of preinstalled apps, though most will be useful including Google’s, Microsoft’s and Samsung’s own. The app draw, for your information, is now accessed with an upwards swipe, which will take some users a while to get used to.

Snap Window

Moving to a bigger screen, despite the phone not being much bigger, presents a problem. A larger display means it’s harder to reach all of it with one hand. As mentioned earlier, things like the camera app have new controls to help you out.

A new feature for the S8 is called Snap Window and takes advantage of the tall screen size. It’s essentially a new part of Multi Window and allows you to snap an app to the top part of the screen. Below it you can carry on like normal on a still larger chunk of the real estate.

Bixby

We said not selling a phone on the software is ‘largely the case’ here because Samsung is making a big deal about Bixby. It might sound like a new mascot, but it’s Samsung’s answer to the likes of Siri and Google Assistant. There’s even a Bixby button on the side so you can access the feature quickly, without unlocking the device.

The idea is you can talk to it without worrying what you can and can’t say. It will also understand the context of what you’re doing. We saw a demonstration that showed it set a wallpaper after launching the gallery with minimal taps.

Bixby Vision can also do some clever things such as tell you about a local landmark you point the camera at, along with additional information about what’s around you like places to eat or provided online prices for a product without scanning the barcode.

It’s all very impressive, but much of the functionality is available via Google Assistant (which is on the phone) and Bixby will be limited to selected Samsung apps to start with. You also won’t be able to use the voice element at launch with UK language support arriving at an unknown later date. Until then, you’ll have to make do with Bixby Home – the interface loads if you push the physical button on the side or swipe right from the home screen. Here you’ll get all kinds of information that should be useful such as the weather, news and tness stats.

DeX

We’re actually more interested in DeX, a docking station that lets you use the Galaxy S8 as a makeshift PC. You connect the phone via USB-C and the dock as two USB ports, Ethernet, HDMI and a cooling fan. You can also use it with a wireless keyboard and mouse and once the phone is docked you’ll get a custom desktop-style interface where you can open and resize apps in separate windows like you would on a PC or laptop.

The demonstration appeared to work very well and could make the Galaxy S8 a decent productivity device for anyone wanting to do general, basic o ce work. Samsung has even optimised its own browser, so it loads the desktop version of websites.

Other new accessories for the Galaxy S8 include a new Gear 360 2 camera and a tweaked Gear VR headset bundled with a motion controller.

Verdict

Our initial impression of the Galaxy S8 is positive indeed. Samsung has taken the best phone around and made it even better with an impressive screen and design. It ticks a shed load of boxes, but check back for a full review soon when we have tested it properly.

Specifications

5.8in (2960×1440, 570ppi) Quad HD display n Android 7.0 Nougat
Dual curved edge display
Exynos 8895 octa-core processor

4GB RAM
64GB internal storage
MicroSD card slot (up to 256GB) n 12Mp rear-facing camera with OIS n 8Mp front camera
Pressure-sensitive home button
Fingerprint scanner
Heart-rate monitor
11ac dual-band Wi-Fi
Bluetooth 5.0 with aptX
GPS
NFC
4G LTE Cat 16
Headphone jack
USB-C
3000mAh non-removable battery n Wireless charging
IP68 dust & waterproof rating
68x149x8mm
155g

Office 365 Connectors and WebHooks: Part 1

The developer story from SharePoint

Let’s be honest: The developer story from SharePoint on-premises to Office365 hasn’t been a straight line. There have been diversions into sandbox solutions, and we’ve dealt with the demons of add-ins and the marketplace. On this journey, we’ve gone from a poor dev story to a pretty compelling dev story today. And if you’ve grown tired of keeping up with the changes, now is a very good time to give things a good second look. The Of ce 365 dev story these days is a combina- tion of many choices. You have to examine the problem as, “Do I want to integrate Office365 into my applica- tion?” or “Do I want to integrate my application into Office365?”

Both scenarios are equally valid.

If you wish to integrate Office365 into your application, you have Microsoft Graph, Azure AD graph, and a deep understanding of Azure AD from a developer point of view to master. Those, paired with your existing skills, on any platform, allow you to integrate Office365 into your application. For example, let’s say that you have a website that sells services to consumers. You require that this website follow your corporate branding guidelines. You don’t want to show the waf e menu on the top, or perhaps you don’t care about any SharePoint functional- ity. However, you do care about showing calendars of the employees on your website. Using Microsoft Graph, you can easily tap into calendar information of the employ- ees in your organization and display them on whatever form you consider appropriate on your highly branded website.

On the other hand, perhaps you want to surface your applications in various well-designated places in Office365. For instance, you may want to surface up a bot or a tab in a team. Or maybe you want to surface up your application as a WebPart on a SharePoint site. Maybe you want to push information into a team.

Increasingly, I see these two camps as the defining paradigm of developing for Office365. And both of these paradigms, thankfully, are being driven by well-accepted standards. There’s a new propensity at Microsoft now to leverage community standards and open source. This means that your skills are portable. If you invest your time in Office365, those skills are not worthless when you need to develop for something other than Office365. And if you invest your time in other technologies, those skills are quite useful in Office365.

In this article, I’ll introduce one such open standard called WebHooks, followed by how Office365 can listen to your WebHooks via connectors. In Part 2 of this ar- ticle (in an issue of CODE Magazine coming soon), I’ll talk about how you can subscribe to WebHooks that Office365 exposes.

Think of it this way: Office365 connectors are how your application can integrate into Office365. And WebHooks exposed by Office365 is how you can integrate Office365 into your applications. Both techniques use the standard WebHooks technique. As I mentioned, WebHooks is an open standard tool, and Office365 currently supports WebHooks only on lists, OneDrive, and mail, but this list will most likely grow.

What Are WebHooks?

WebHooks are user-de ned HTTP callbacks. The problem they intend to solve is “pushing” information to you. Pushing is an unusually complex problem to solve. We’ve gotten so used to server-based applications, such as Office365 resources, to expose a REST API that you “pull” information from. Your application makes an HTTP call to nd out if there is anything new. Pull works, but has some distinct disadvantages. It’s certainly not respon- sive enough for real-time operations, such as chat. And more importantly, it puts an undue load on both your application and the server.

Push, on the other hand would be nice, except, that Office365 (or any server-based resource) doesn’t know where or who to push to. WebHook is an architectural pattern that aims to solve this issue.

Put simply, if you want SharePoint to inform you that a list has changed, you need to get an HTTP POST from Office365 to an endpoint that you expose. Before Office365 can send you a push, it needs to know where to send the push. A WebHook starts with subscribing to an end- point where you express that you’re interested in learn- ing about a speci c noti cation, and that you’d like to be informed at such-and-such endpoint, which that server- based resource can push information or noti cations to.

Before this subscription is considered valid, the server- based resource veri es that there’s an endpoint listening. And if an endpoint is indeed there, the subscription is created. In the future when the event occurs, this end- point is called.

Of course, there are many other nuances to be consid- ered, such as how long should such a noti cation subscription last? If the listener isn’t around to receive a push request, should there be any retry logic? How quickly should your endpoint respond? Should you send secure information in a push? How do you ensure that the server you created a subscription to is the one push- ing the information?

Every platform implements things differently. In Office365, the behavior is as follows:

  • The subscription lasts for a maximum of six months.
  • There is a retry logic built that retires every five minutes.
  • Your endpoint is expected to respond within five seconds. This time is intentionally short to reduce load on Office365 server resources and prevent DDoS scenarios.
  • No secure information is sent and you’re expected to call back and get the nature of changes. The WebHook simply noti es you that “something has changed.” This is a good implementation because you want the WebHook to be responsive, and you can only make it responsive if the request size is predictable. Also, not sending sensitive informa- tion on a push noti cation is more secure.
  • You can be sure, as a recipient of a push, that the push came from who you subscribed to, by provid- ing a validation code during your subscription. This validation code is your shared secret between Office365 and your service.

    Office365 Connectors

    At its heart, Office365 facilitates collaboration. Sure, there are tools like Word, Excel, etc. But the bottom line is that Office365 helps you manage information, and it helps you do so between teams. With that in mind, Mi- crosoft introduced the concept of Office365 Groups. A group is exactly what it sounds like: a number of people, a group, who want to work together. You create this group, and “hang” different things on the group.

    For instance, a group can have a team site. In fact, mod- ern team sites are backed by a group. The groups can have an email address and a shared inbox. But why stop there? They can also have a shared calendar, a shared OneNote notebook, planner etc. In fact, if you create a new group in Office365 and you examine the top tab bar, you’ll see these various things “hanging off” of the group.

    1. Many useful and common tabs are already present. You can add more tabs, too, which is one way to surface up your applications inside Of ce 365, speci cally applications targeted toward a particular group. Notice that a rather interesting tab is already present: Connectors.

    Connectors is Office365’s mechanism of allowing numer- ous third-party services to push information into an Office365 team. The idea is that the team sets up a subscrip- tion to a connector. There’s so much information to stay on top of these days, such as tracking search results, Twit- ter feeds, news headlines, and so much more. Whenever the third-party has anything of value to contribute, it can push it into the team’s user interface via this connector.

    Setting Up the Out-of-the-Box Connector

    Because connectors are aimed toward business users, set- ting one up is easy. It doesn’t require you to write any code; a connector can be set up using point-and-click. Just visit the team within your Outlook site, and on the tab, look for the Connectors link.

    When you click on the Connectors tab, you’ll see a num- ber of connectors to pick from. If any connectors are al- ready con gured, you’ll see the con guration details of those speci c connectors. One of the simplest connectors is the “Bing News” connector. Go ahead and click on it and con gure it.

    That’s it. Hit Save and assuming that you have the per- missions, the connector is set up. You’ll start seeing the information pushed by this connector inside the team’s inbox right away.

    How Does It Work?

    How does any connector work? Let’s think of connectors generically. The overall ow of the application.

    As you can see from Figure 3, when a user wishes to ac- cess any connector, they’re presented with a simple HTML UI, usually a “Connect to Of ce 365” button. It doesn’t have to look exactly like that, but consistency is good, so users know what to expect. The user clicks on that button and is prompted to grant access to the connector. As- suming the user has the rights, your app now gets a URL to which it can push information. These pushes are done using HTTP POST requests, and are sent as JSON objects in a speci c schema. Of ce 365 connectors likes to call them JSON Cards.

    You may be thinking that this sounds pretty straightfor- ward. Can you write your own connector? Yup. It’s easy!

    Using the Incoming WebHook Connector
    Writing Of ce 365 connectors can be accomplished in two ways. If you wish to have a connector that pushes information into a single team, you can use the Incom- ing WebHook connector. This greatly simpli es the task of writing connectors. If you wish to have your connec- tor reused across multiple teams, then you might as well write a “real” connector.

    Let’s rst look at the process of using the Incoming Web- Hook connector. Creating an incoming WebHook is really easy. Just click on the Connectors tab under your team as shown in Figure 1, and look for Incoming WebHook. Click on it, and con gure it, as shown in Figure 4.

    When you click the “Create” button, you’re given a long and complex URL, as shown in Figure 5.

    This URL is your key to pushing information out to the speci ed team. Copy and paste it into notepad because you’ll need it soon. Now to send a JSON card to your team via this newly con gured incoming WebHook, all you need to do is send an HTTP POST message to the URL you got in the Incoming WebHook screen shown.

    When you hit Execute on the request composing screen shown in Figure 6, Fiddler informs you that you were suc- cessful by sending an HTTP 200 status code.

    That was quite easy, wasn’t it? Now all you need is some sort of process that sends a POST request to this end- point whenever you want to inform the team of anything. Imagine a team of developers that gets a push noti ca- tion on a successful build? Or a marketing team that gets informed of a new product release? Or a sales staff that gets informed of marketing leads ready to close and that are tied to your CRM system? You now have the power of keeping people informed. And it wasn’t dif cult at all.

    But there is one small problem. Trying to re-use the same connector in multiple teams and having to set it up man- ually everywhere could mean a lot of manual work.

    Writing a Real Connector

    The Incoming WebHook connector works great if you’re okay with setting up a connector manually in each team interested in the connector and then updating the ser- vice with the provided URLs. It doesn’t work so well if you wish to scale to multiple teams. You want to write a “real” connector, one that can scale with minimal atten- tion and effort. Perhaps you want to create something that you could even offer for sale in the marketplace. Or, at the very least, you want to create your Connect to Office365 button, which the user can click on and be guided through a simple set up process.

    It turns out that it’s not very dif cult to do. First, you need to register your connector at this URL: http:// go.microsoft.com/fwlink/?linkid=780623. This page asks you to sign in using your Office365 credentials and pro- vides a simple user interface where you can register one or more connectors.

    The form asks for a number of things. Most of them, such as name, logo etc., are self-explanatory, but the impor- tant ones are these:

    • List the events supported by your connector. This is what the user will see. A single connec- tor can support multiple events. For instance, your source control connector may have a sepa- rate event for successful or failed build. Perhaps the failed build could be set up differently, so it’s obviously different from a successful build. Maybe you want all developers to see a failed build no- ti cation but a successful build noti cation could be ignored.

    • Landing page for your users. This is where us- ers will see the Connect to Office365 button. Of course, you can choose to have a different user experience, but the general idea here is that us- ers will have a choice about using your connector. Clicking on that link within the Office365 teams/ connectors tab takes the user to this landing page. On this page, the user is expected to con gure the connector. For instance, a Twitter connector may ask for search terms or a connector for your garage door may ask you for the events you’re interested in, such as “Garage door left open for > 15 min- utes,” etc.

    • Redirect URL: Once the connector is set up, Office365 needs to communicate the endpoint to which you can push JSON cards. This endpoint URL is com- municated to the Redirect URL. Your connector is expected to save this URL in a secure place.

    Copy and paste the HTML shown in Figure 8 onto the landing page URL within your application. For dev pur- poses, you can use localhost. However, if you choose to use the “Publish to store” option, which is a matter of clicking a button on your app registration page, you’ll need to use a real URL.

    The Connect to Office365 Button

    I’ve mentioned this button a few times. But what exactly does this button do? Clicking on this button asks the end user to authorize your connector to the Office365 group. It does so by redirecting the user to the Redirect URL of the connector registration page that you set up in the last section. And when it does so, it passes the following information:

    Summary

    There are so many ways to develop for Of ce 365! Luckily, for the last couple of years, Microsoft has been on the path of open standards and open source. WebHooks is a technology that gained acceptance outside of Of ce 365 before Of ce 365 offered it as an option. You can use this technique to both listen to Of ce 365 WebHooks and be noti ed by Of ce365. Or, you can provide Of ce 365 with noti cations at appropriate places via connectors.

    In this article, I talked about pushing noti cations into an Of ce 365 team via connectors. In this set up, you wrote a WebHook. In my next article, I’ll demonstrate how Of ce 365 can push noti cations to you, where Of- ce 365 is the WebHook and you are the listener.

    • state: An optional parameter that provides custom state information to the Redirect URL
    • app_id: The identi er GUID for your application
    • callback_url: The HTTPS Redirect URL for your con-nector registration

      The Redirect URL, as I mentioned above, is a URL that your connector exposes. It receives the WebHook URL, which is the URL that you send JSON cards to. In addition to the Redirect URL, it can also get the state informa- tion, the group name to which you are connecting the connector, and any errors that may have occurred during the registration. For instance, if the user decides not to grant access to the connector, you’ll get an access denied error, and you can then show the user an appropriate message.

      Sending JSON Cards

      Assuming that you’ve registered the connector, created a website with the Connect to Of ce 365 button and a

From Zero to CRUD in Angular: Part 1

Create, Read, Update, Delete (CRUD) pages

Many business application Web developers build Create, Read, Update, Delete (CRUD) pages in their day-to-day jobs. Over the years, you might have built these pages in Classic ASP, Web Forms, and MVC. You might have even used JavaScript, jQuery, and possibly AngularJS. It’s now, once again, time to learn how to build a CRUD page using Angular 4. In this series of articles you’ll start with an empty Web application, built using Vi- sual Studio 2015, and build up to a complete CRUD page.

In this rst part, you’re going to create a new Web project, add the appropriate Angular les, and display a simple page. You’re then going to create a Product table, build an Entity Framework data layer to retrieve data from that table, and create a Web API to call from Angular. You’ll nish by displaying a list of products on an HTML page by calling the Web API. You can see the nished HTML.

Set Up Your Computer

Before you begin to create an Angular application, you must prepare your development computer. There are two tools required: Node.js and Node Package Manager. In addition, you must con gure Visual Studio 2015 to use TypeScript. You should also get the Angular QuickStart project at https://github.com/angular/quickstart.

Install Node

If you haven’t done so already, download and install Node.js and NodeJS Package Manager (npm). You can get these two packages at https://nodejs.org/en/download/.

Follow the instructions for downloading and installing these tools on nodejs.org.

Configure Visual Studio 2015

Most developers use TypeScript for Angular develop- ment. Ensure that you’ve downloaded and installed TypeScript 2.x for Visual Studio 2015. Select the Tools > Extensions and Updates menu to bring up the Exten- sions and Updates window (Figure 1) for Visual Studio. Click on the Installed node in the tree view and look through your list to see if you’ve installed TypeScript 2.x. If you have an older version of TypeScript, you need to update it.

To update to TypeScript 2.x, click on the Online node in the tree view and perform a search for TypeScript. Locate the latest version of TypeScript and download and install it into Visual Studio.

One last con guration item for Visual Studio is to select the Tools > Options menu and expand the Projects and Solutions node. Click on the External Web Tools (Figure 2). Ensure that the $(PATH) variable is located above any $(DevEnvDir) variables, if they exist, in your environment. If you don’t move this up, Visual Studio attempts to use its own tools instead of npm to update packages. In my installation of Visual Studio, these variables didn’t exist.

Install Angular Quick Start

Now that you’ve con gured Visual Studio, you’re going to need some con guration les and some TypeScript les to make it easier to get started with Angular. The Angular team has created a sample project that contains these les. This sample project is not a Visual Studio project, so you’re only going to use some of the les from this proj- ect and not bring all of them into your project. Download the quick start zip le from https://github.com/angular/ quickstart. After the zip le has downloaded, unzip the les into a folder on your hard drive.

Create Web Project for Angular

With your computer now appropriately con gured, let’s walk through the steps of creating and running your rst Angular application. This ensures that your environment is con gured correctly prior to trying to add the Web API and make HTTP calls.

Create a New Web Project

Start Visual Studio 2015 and select File > New > Project… from the menu. From the tree-view in the New Project win- dow (Figure 3), expand Templates > Visual C# > Web. Click on the Web node and from the list of templates, select the ASP.NET Web Application (.NET Framework). Set the Name of the new project to ProductApp. Click the OK button.

After clicking the OK button, you’re taken to a screen (Figure 4) that shows you a list of ASP.NET 4.5.2 Templates. Select the Empty Web project. You’re going to use the Web API to retrieve data from a SQL Server table, so check the Web API check box. Click the OK button and Visual Studio creates your new project.

Add Angular Files

Using Windows Explorer, navigate to the QuickStart les you downloaded earlier. Do NOT copy all of these les into your Visual Studio project because you don’t need all of them. Locate and copy the following les into the root of your new Visual Studio project.

  • • \bs-con g.json
  • • \package.json
  • • \tslint.json

Copy the whole folder \src into the root folder of your VS project.

Expand the \src folder and select the \app folder and all les within the folder. Right-mouse click and select the Include in Project menu. When you’re prompted to include the TypeScript typings, just answer No.

Restore Packages

Even though you’ve added an HTML page and some Type- Script les, nothing’s going to work yet. You need to download a whole new folder using the package manager utility (npm). Visual Studio can download all of these les using npm, but you must rst close and reopen Visual Studio. If you don’t close and reopen Visual Stu- dio, the appropriate menu item won’t show up. Go ahead and close your instance of Visual Studio now, and then reopen the ProductApp project. Right-mouse click on the package.json and select Restore Packages from the menu (Figure 5). This process takes a little while, so be patient.

After the installation of the packages is complete, click on the Show All Files icon in the Solution Explorer win- dow. A new folder has appeared named node_modules (Figure 6). DO NOT include this folder in your project. You don’t need all of these les. They’re just there to support the various libraries you use when developing with Angular.

At this point, you’re ready to test and see if you’ve hooked up everything correctly. Press F5, and if you have everything correct, you’ll see a page displayed in your browser

Add Bootstrap

To give your application a more professional appearance, add Twitter’s Bootstrap using the NuGet Package Man- ager. Right-mouse click on the ProductApp project and select Manage NuGet Packages… from the menu. Click on the Browse tab and search for “bootstrap.” Click the Install button to have Visual Studio download and add the appropriate les to your ProductApp project. Add the appropriate <link> and <script> tags to the index.html les by dragging and dropping them from your project folders into the <head> element. Be sure to put them in the following order.

<link href=”Content/bootstrap.min.css” rel=”stylesheet” />

<script src=”Scripts/jquery-1.9.1.min.js”> </script>
<script src=”Scripts/bootstrap.min.js”> </script>

Eliminate Hard-Coded

HTML Templates

In Figure 7, you saw the words “Hello Angular” appear. These words came from an HTML snippet contained in the app.component.ts le. I don’t like having HTML written in TypeScript, so I create an HTML page to display the HTML for the landing page of my Angular application.

Right-mouse click on the \app folder and select Add > HTML Page and set the name to app.component.html. Click the OK button. Remove the HTML in the page and replace it with the following:

<div class=”row”>
<div class=”col-xs-12″>

<h1>{{pageTitle}}</h1> </div>

</div>
In the HTML above, the value for a variable named pageTitle is going to be retrieved from the AppComponent

 

Figure 7: If you get to this page, your Angular installation is working.

class and displayed within an <h1> element. Open the \app\app.component.ts le and you’ll see the following declaration.

@Component({
selector: ‘my-app’,
template: `<h1>Hello {{name}}</h1>`

})

Create, Read, Update, Delete (CRUD) pages

Now that you’ve created the new HTML page, you’re go- ing to remove the hard-coded HTML from the template property in the @Component decorator. Note that the template property uses the back-ticks and not apostro- phes for creating the hard-coded HTML template. If you wish to use hard-coded templates like this, you need to use the back-tick. I have found, however, that if you have any more than a few lines of HTML, this property becomes cumbersome to maintain. Let’s change the tem- plate property to the templateUrl property and set that property to the string ‘app.component.html’. Once you use a le name, you switch to using apostrophes.

Another change you’re making to this @Component decorator is adding the property moduleId and set- ting that property to the value module.id. This prop- erty helps Angular understand relative paths in rela- tion to the current component. If you didn’t use the moduleId property, you change the templateUrl prop- erty to ‘./app/app.component.html’. I prefer to use relative paths, as opposed to having to fully qualify the path in relation to the root.

The AppComponent class that came with the QuickStart sample has a name property set to the word ‘Angular’. The next snippet is the code in the app.component.ts le.

export class AppComponent { name = ‘Angular’;

}

In the app.component.html page you created, you changed the HTML to bind to a property called pageTitle. Remove the name property and add the pageTitle prop- erty, as shown in the following code snippet.

export class AppComponent {

pageTitle = ‘Product Application; }

The last thing to do is to modify the index.html to use the Bootstrap CSS. Add a <div> element immediately after the <body> element. Set the CSS class equal to “contain- er”. All other HTML pages in your Angular application are going to be loaded within the <my-app> directive, so you want them all to live within a Bootstrap container style.

<body>
<div class=”container”>

<my-app>
<p>Loading application…</p>

</my-app> </div>

</body>
If you run the application again, you’ll see the same page as before but now with the text Product Application.

How All of the Pieces Fit Together

Now that you have your Angular application up and run- ning, let’s look at the various les you added and how they relate to one another. In Figure 8, you can see an overview of all the HTML and TypeScript les you’ve worked with thus far.

The following numbers are a description of each of the numbers contained in Figure 8.

1. The application runs index.html, which runs the JavaScript System.import() function to load and run the code within the \app\main.ts le.

2. The code in main.ts imports the code from the app. module.ts le. The AppModule class, de ned in app. module.ts, is used as the “bootstrap” code to start the Angular application.

3. The AppModule class is empty, but what’s important is the @NgModule decorator to de ne various metadata for the module. The one you’re concerned with right now is the declarations property, which identi- es AppComponent class as the root component for the Angular application. The AppComponent class is de ned in the app.component.ts le. The app. component.ts le is imported at the top of the app. module.ts le.

  1. The AppComponent class has a @Component deco- rator that sets the selector property with a name of my-app. This selector is used as the HTML directive <my-app> on the index.html page. The my-app di- rective is associated with the AppComponent com- ponent, so it knows to look at the templateUrl prop- erty to identify the HTML page it needs to insert into the location of the <my-app> directive.
  2. The HTML in the app.component.html page is read and inserted into the index.html where the <my- app> directive is located.
  3. Prepare the Server-Side Code

    Now that you have your client-side Angular application work- ing, create a SQL Server table and code for your server-side. On the server-side, you need to create a table to hold prod- uct data, an Entity Framework data layer, and a Web API. In addition, you need to add some code in the Global.asax le to change the case of the C# property names to be camel- case to more closely match JavaScript coding standards.

    Create Product Table

    To create the page that lists product data (Figure 11), create a table called Product in a SQL Server database. In the following code snippet, you can see the full de nition of the Product table.

    Once you create the table, add some data to each eld. Create enough rows that you can see several rows on your nal HTML page. In Figure 9, you can see the data that I used to create the list of product data for this sample application.

    Build Entity Framework Model

    With your Product table in place, you need a data layer to be able to retrieve and modify the data in that table. Let’s use the Entity Framework code generator that’s built-into Visual Studio to create this data layer. This code generator allows you to list, add, edit and delete data from the Product table.

    Right-mouse click on the \Model folder and select Add > New Item… Click on the Data node and then select ADO. NET Entity Data Model from the list of templates. When prompted for the item name, type in ProductDB. Click the Add button to move to the next step in this process

    Select Code First from database and click the Next button to create a server connection. Create a new connection to the database where you installed the Product table. After creating the connection, leave everything else the same in this step of the wizard and click the Next button.

    Expand the tree view and locate the Product table you previously created. Click the Finish button to have Visual Studio create the Entity Framework data model for the Product table.

    After the Entity Framework generates the classes, you’ll have an entity class called Product that has the properties listed in the next snippet. I’m showing this class to you because you’re going to create a corresponding Angular Product class in TypeScript later in this article. Don’t add this class; it’s already there in the \Model folder.

    public class Product {

    public int ProductId { get; set; }
    public string ProductName { get; set; } public DateTime IntroductionDate { get; set; } public string Url { get; set; }
    public decimal Price { get; set; }

    }

    Sample Code

    You can download the sample code for this article by visiting my website at http://www.pdsa.com/ downloads. Select PDSA Articles, and then select “CODE Magazine – From Zero to CRUD in Angular – Part 1” from the drop-down list.

    Create Web API

    To retrieve data from your Product table from within an Angular application or any client-side technology, you must create a Web API. Right-mouse click on the \Con- trollers folder and select Add > Web API Controller Class (v2.1) from the menu. Set the name to ProductCon- troller and click the OK button. Add a Using statement at the top of this controller le to include the namespace generated by the Entity Framework.

    using ProductApp.Models;

    Delete all of the code within this new controller class, as you’re going to write your Web API methods using a more updated approach than what’s generated by Visual Studio. Type in the code listed in the code snippet below to create a method that retrieves all products from the Product table.

    public IHttpActionResult Get() { IHttpActionResult ret; ProductDB db = new ProductDB();

    if (db.Products.Count() > 0) { ret = Ok(db.Products);

    } else {

    ret = NotFound(); }

    return ret; }

    Fix the Global.asax

    Earlier, I mentioned that the C# class Product is going to have a similar class created on the client-side that maps all properties one-to-one. However, the C# class uses pascal-casing of properties, and the TypeScript class is going to use camel-casing. You can add code to the Application_Start method in the Global.asax le to auto- matically convert properties from pascal-case to camel- case. Open the Global.asax le and at the top of the le add the two using statements shown in this code snippet.

    using Newtonsoft.Json.Serialization; using System.Net.Http.Formatting;

    Modify the Application_Start method to look like the code shown in Listing 1. The code you’re adding to the Application_Start method selects the current GlobalCon- guration.Con guration property and assigns it a vari- able called con g. The next line of code instructs the formatter to ignore any self-referencing objects in the Entity Framework. There aren’t any in this application, but this code can be useful when the Entity Framework generates more tables that have references to one an- other.

    The next line of code queries the Formatters collection and retrieves the rst instance of any JsonMediaTypeFor- matter object it nds. Finally, you create a new instance of a CamelCasePropertyNamesContractResolver and as- sign that to the formatter’s ContractResolver property. This property controls how the JSON objects are format- ted and sent to the client-side caller.

    Build Client-Side Product List

    Now that you have your server-side pieces in place and have gotten Angular to work in your project, you can start building the HTML and classes to create a list of products. You’re going to create a folder under the \app folder for each of your different pages. In this sample, you’re building a system for handling products, so you’re going to create a \product folder. If you add more pages to handle customers, you create a \customer folder, and so on. This helps you keep all of your different pages or- ganized. In this part of the article, there are four new les that you’re going to create. These four les are sum- marized in Table 1.

    File

    Description

    product.ts

    A class that represents a single Product object

    product.service.ts

    A class to call the Web API to retrieve product data and return an array of Product objects

    product-list.component.html

    The HTML needed to display the table of product data

    product-list.component.ts

    The class with properties and methods to display the product data

    Create Product Class

    As you’re going to retrieve a collection of Product class- es from the Web API, you need a Product class written in TypeScript. Add a new folder under the \app folder named \product. Right-mouse click on this new folder and select Add > TypeScript le from the context-sensi- tive menu. Give this new le the name of product.ts. Add the following code in this le.

    export class Product { productId: number; productName: string; introductionDate: Date; price: number;

    url: string;

    categoryId: number; }

    Notice that the structure of this class is exactly like the Product class that the Entity Framework generated. The only difference is the use of camel-case instead of pas- cal-case. Remember that you added code in the Global. asax to handle this conversion for you.

    Listing 1: Modify the Global.asax to automatically convert the casing of properties.

    protected void Application_Start() { GlobalCon guration.Con gure(WebApiCon g.Register);

    // Get Global Con guration

    HttpCon guration con g = GlobalCon guration.Con guration;

    // Handle self-referencing in Entity Framework

    con g.Formatters.JsonFormatter .SerializerSettings.ReferenceLoopHandling =

    Newtonsoft.Json.ReferenceLoopHandling.Ignore;

    }

    // Convert to camelCase

    var jsonFormatter = con g.Formatters .OfType<JsonMediaTypeFormatter>()

    .FirstOrDefault();

    jsonFormatter.SerializerSettings .ContractResolver = new

    CamelCasePropertyNamesContractResolver();

    Listing 2: The product service retrieves a collection of products from your Web API.

    import { Injectable } from ‘@angular/core’; import { Http, Response } from ‘@angular/http’; import { Observable } from ‘rxjs/Observable’; import ‘rxjs/add/operator/map’;
    import ‘rxjs/add/operator/catch’;
    import ‘rxjs/add/operator/throw’;

    import { Product } from “./product”;

    @Injectable()
    export class ProductService {

    private url = “api/product”; constructor(private http: Http) {

    }

    getProducts(): Observable<Product[]> { return this.http.get(this.url)

    .map(this.extractData) .catch(this.handleError);

    }

    private extractData(res: Response) { let body = res.json();
    return body || {};

    }

    private handleError(error: any): Observable<any> { let errors: string[] = [];

    switch (error.status) { case 404: // Not Found

    errors.push(“No Product Data Is Available.”); break;

    case 500: // Internal Error errors.push(error.json().exceptionMessage); break;

    default:
    errors.push(“Status: ” + error.status

    + ” – Error Message: ” + error.statusText);

    break; };

    console.error(‘An error occurred’, errors); return Observable.throw(errors);

    } }

    Create Product Service

    You need an Angular product service to call the Web API controller that you created earlier. This product service retrieves all products. Right-mouse click on the \app\ products folder and select New > TypeScript le from the menu. Set the name to product.service.ts and click the OK button. Add the code shown in Listing 2.

    Let’s break down the code in Listing 2. You rst import the various classes and functions you need for this ser- vice using the ‘import’ keyword.

    import { Injectable } from ‘@angular/core’; import { Http, Response } from ‘@angular/http’; import { Observable } from ‘rxjs/Observable’; import ‘rxjs/add/operator/map’;
    import ‘rxjs/add/operator/catch’;
    import ‘rxjs/add/observable/throw’;

    import { Product } from “./product”;

    The injectable class is needed to support the use of the @ Injectable decorator attached to the ProductService class. This decorator informs Angular that this class may be in- jected into the constructor of any component. The HTTP and Response classes are used to access the Web API and to retrieve the response from the Web API. Next, is the Observ- able import. You’re going to retrieve data using the Angular HTTP service. This service returns all calls from a Web API as an Observable object. Next are a series of imports that provide extension functions such as map, catch, and throw.

    These functions, as well as the Observable object, are supplied by RxJS or Reactive Extensions for JavaScript. You can learn more about these libraries at https:// github.com/Reactive-Extensions/RxJS. The RxJS library helps you transform, compose, and query any type of

    data. In the ProductService class, you use it to take the result set of data you retrieve from the Web API and map it to an Angular Observable object.

    The last import is the Product class you created. Because you want to return an array of product objects returned from the Web API, you must import this class.

    Angular injects the HTTP service into the ProductService class. Any class marked with the @Injectable decorator may be injected into any class by declaring it in the con- structor. The HTTP service class, created by the Angular team, has been decorated with the @Injectable decorator.

    constructor(private http: Http) { }

    The next two functions in the class are getProducts and extractData. The getProducts function calls the Web API using the get function of the HTTP service. It creates a promise using the toPromise extension function. If data is retrieved, the then function is called and passed a ref- erence to the extractData function. You don’t really need the extractData function, but I like having this function as it makes it easy for to set a breakpoint and see the data that’s been returned. The extractData function is passed in the HTTP response object. Call the JSON function on this response object to retrieve the array of product data.

    getProducts(): Observable<Product[]> { return this.http.get(this.url)

    .map(this.extractData) .catch(this.handleError);

    }

    private extractData(res: Response) { let body = res.json();

    return body || {}; providers: [ProductService] } })

    The last function in this class is handleError. This func- tion is used to publish the error information and return an Observable object with a string array of the errors re- turned from the call. I’m going to also output the error(s) to the console window of the browser. Use a switch/case statement so you can supply different error messages based on what’s returned from the Web API call. Inform the calling code of the error by passing the errors array to the throw function on the Observable class.

    Update the app.module.ts File

    In order to inject the HTTP service into the ProductSer- vice class, you need to import the HttpModule in the app. module.ts le. You then add this imported module to the @NgModule imports property. This makes it available for use in any of your classes. Angular takes care of injecting this service whenever it sees a reference to HTTP, as you saw in the constructor of your ProductService class.

    import { HttpModule } from ‘@angular/http’;

    @NgModule({
    imports: [BrowserModule, HttpModule ] …

    })

    Remember that you marked your ProductService as an @ Injectable class. This means you want Angular to auto- matically inject this service into any of your class con- structors. To accomplish this, you also need to import the ProductService in your app.module.ts le and add this class to the providers property.

    import { ProductService }
    from “./product/product.service”;

    @NgModule({
    imports: [BrowserModule, HttpModule ], declarations: [ AppComponent ],

    Add the Product List HTML Page

    It’s now nally time to build the components needed to display a list of products like the page shown in Figure 11. Add a new HTML page named product-list.component. html to the \app\product folder. Remove all of the HTML in the new page and enter the HTML shown in Listing 3.

    In the HTML that builds the product table, use the *ngIf directive to test to see if there are any products. If there are, you build an HTML table using the *ngFor directive to iterate over a collection named products in the Pro- ductListComponent class. Each time through the loop, a product object is assigned to a local variable named prod- uct. Use this product variable to retrieve each property of the Product class and display the value of each in each cell of the table.

    At the end of the HTML, there’s another <div> element that displays any messages in an unordered list. You may receive errors if the call to the Web API failed for some reason, or maybe there was no data in the table. In that case, the messages property of the ProductListComponent class is lled in with an array of string messages to display.

    Create the Product List Component

    From the HTML in Listing 3, you know that your Pro- ductListComponent class (Listing 4) must expose two properties to the HTML page products and messages. This class must be injected with the ProductService class from which you can request the product data. This class must also have some exception handling in case the Web API throws an exception or doesn’t return data. Create the Pro- ductListComponent class by adding a new TypeScript le under the \app\product folder named product-list.com- ponent.ts. Write the code contained in Listing 4.

    Let’s look at each piece of the ProductListComponent class, and learn why you need each line of code and what each does. The rst step is to import the various classes you use within this class. The following four imports are used in this class.

    import { Component } from “@angular/core”; import { OnInit } from ‘@angular/core’;

    import { Product } from “./product”; import { ProductService }

    from “./product.service”;

    You can see the Component import is needed for the @ Component decorator. The templateUrl property in the decorator points to the product-list.component.html page that you just created.

    The OnInit import is an abstract class and isn’t absolutely necessary, but I like to use it to ensure that I type in the correct function name: ngOnInit. The ngOnInit function is a lifecycle event raised when the Angular engine cre- ates an instance of this class. Use the ngOnInit function to call the getProducts function to retrieve the product data from your product service class.

    The last two imports are easy to understand. You need the Product class because you’re going to ll an array of Product objects from your call to the product service. The constructor for this class receives the ProductSer- vice class from the Angular injection and assigns that instance to the private property named productService.

    constructor(
    private productService: ProductService) {

    }

    Two properties are declared in this class: products and messages. The products property is an array of Product objects. Initialize this property to an empty array by us- ing the = []; syntax after the declaration of this prop- erty. The messages property is also a string array used to display any error messages on the page.

    // Public properties

    products: Product[] = []; messages: string[] = [];

    The getProducts function calls the getProducts function from the ProductService class. This function returns an

    <div class=”row”
    *ngIf=”products && products.length”>

    <div class=”col-xs-12″>
    <div class=”table-responsive”>

    <table class=”table table-bordered table-condensed table-striped”>

    <thead> <tr>

    <td>Product Name</td> <td>Introduction Date</td> <td>URL</td>
    <td class=”text-right”>Price</td>

    </tr> </thead> <tbody>

    <tr *ngFor=”let product of products”> <td>{{product.productName}}</td> <td>{{product.introductionDate | date }} </td>

    <td>{{product.url}}</td>

    <td class=”text-right”>
    {{product.price | currency:’USD’:true }}

    </td> </tr>

    </tbody> </table>

    </div> </div>

    </div>

    <div class=”row”
    *ngIf=”messages && messages.length == 0″>

    <div class=”col-xs-12″>
    <div class=”alert alert-warning”>

    <ul>
    <li *ngFor=”let msg of messages”>{{msg}}</li>

    </ul> </div>

    </div> </div>

    Listing 4: The product listing component.

    import { Component } from “@angular/core”; import { OnInit } from ‘@angular/core’;

    import { Product } from “./product”;
    import { ProductService } from “./product.service”;

    @Component({
    moduleId: module.id,
    templateUrl: “./product-list.component.html”

    })
    export class ProductListComponent implements OnInit {

    constructor(private productService: ProductService) { }

    ngOnInit(): void { this.getProducts();

    }

    // Public properties

    products: Product[] = []; messages: string = [];

    private getProducts(): void { this.productService.getProducts()

    .subscribe(products => this.products = products, errors => this.handleError(errors));

    }

    private handleErrors(errors: any): void { for (let msg of errors) {

    this.messages.push(msg); }

    } }

    Observable object, so you can use the subscribe func- tion to retrieve the product array and assign it to the products property in this class. If an error occurs when calling the Web API, the second parameter to subscribe is called. Take the error object passed back from the Prod- uctService and pass that to the handleError function in this class.

    getProducts(): void { this.productService.getProducts()

    .subscribe(
    products => this.products = products, errors => this.handleError(errors)

    );

    The handleError function is passed into the array of er- rors from the call to the product service. This function loops through the errors array, extracts each message and pushes it onto the messages array. Because this messages property is bound to the unordered list on the product-list.component.html page, the error messages are displayed within that list.

    private handleErrors(error: any): void { for (let msg of errors) {

    this.messages.push(msg); }

    }

    }

    Update the app.module.ts File

    Just like you did with the other components that you added to the project, add the ProductListComponent class to the app.module.ts. Open the app.module.ts le and add an im- port near the top of the le that looks like the following:

    import { ProductListComponent }
    from “./product/product-list.component”;

    In the @NgModule decorator, add the ProductListCom- ponent class to the declarations property by adding a comma after AppComponent and typing in the name of this class as shown below:

    declarations:
    [ AppComponent, ProductListComponent ]

    Listing 5: The routing class de nes one or more routes for your application.

    import { NgModule } from ‘@angular/core’; import { RouterModule, Routes }

    from ‘@angular/router’; import { ProductListComponent }

    from “./product/product-list.component”;

    const routes: Routes = [ {

    path: ‘productList’,

    component: ProductListComponent }

    ];

    @NgModule({
    imports: [RouterModule.forRoot(routes)], exports: [RouterModule]

    })
    export class AppRoutingModule { }

    Angular Routing

    No Angular application would be complete without rout- ing. Routing allows you to navigate from one page to an- other. The app.component.html page you created earlier is the main page for getting to other pages in this ap- plication. You’re going to add a router-outlet directive to this page. Add the following HTML below the other HTML on this component.

    <div class=”row”>
    <div class=”col-xs-12″>

    <nav>
    <a class=”btn btn-primary”

    routerLink=”/productList”> Product List

    </a> </nav> <br />

    <router-outlet></router-outlet> </div>

    </div>

    The key pieces in the HTML above are the routerLink at- tribute in the anchor tag and the <router-outlet> direc- tive. The <router-outlet> directive tells Angular where to insert the HTML supplied by the component that’s routed to by the value in the routerLink attribute. It’s the value in this attribute, productList, that you’re going to match up with a route de ned in a TypeScript le called app- routing.module.ts. Add a new TypeScript le called app- routing-module.ts and add the code shown in Listing 5.

    The important part of the app-routing.module.ts le is the constant named routes. This constant contains an array of Route objects. Each object has a path property that’s used in the routerLink attribute you created earlier. If the path matches the address in the browser, the component prop- erty is used to instantiate an instance of the object listed in this property. Once this class is instantiated, the HTML de ned in that class’ templateUrl property is inserted into the location where the <router-outlet> directive is located.

    The route’s constant is added to the singleton instance of the Router service using the forRoot function. You can

    see this in the imports property of the @NgModule deco- rator. You can add as many routes to the routes constant as you need for your application.

    Overview of Angular Routing

    With all that description above, I thought a graphical representation of the Angular routing you’re using in this application might help clear things up a little. Here’s a description of each of the numbers you see in Figure 10.

    1. Anytimethebrowser’saddressbarisupdatedviaan anchor tag or other mechanism, the last part of the address is matched up to one of the routes added to the singleton instance of the Router service.
    2. Once Angular nds the path in the Router service, Angular instantiates the class listed in the compo- nent property.
    3. After the class is instantiated, the templateUrl property is read from the @Component decorator.
    4. The HTML from the le listed in the templateUrl property is loaded and inserted into the DOM at the location of the <router-outlet> directive.

    Update the app.module.ts File

    Declare your intention to use routing by importing it into the app.module.ts le. Open the app.module.ts le and add the following import statement near the top of the le.

    import { AppRoutingModule } from ‘./app-routing.module’;

    Add the AppRoutingModule to the imports property in the @NgModule decorator. The imports property should now look like the following code snippet.

    imports:
    [BrowserModule, HttpModule, AppRoutingModule ]

    Run the Page

    At this point, you can run the page and see a list of the product data you entered into your Product table. If you entered the same data that I did, you should see a page that looks like Figure 11.

    Summary

    Congratulations! You’ve successfully created your rst Angular application using Visual Studio. There are a lot of steps to get Angular up and running, but once you get the basics con gured, adding new pages and new com- ponents is quite easy because you use the same pattern that you learned in this article. In my next article, you’re going to add a detail page, select a single product from a Web API call, and then learn to add, edit, and delete a product.

    Read more about computers and programming here