Deeplinking  (how to force out of Facebook's in-app browser and fallback on desktop)

Deeplinking (how to force out of Facebook's in-app browser and fallback on desktop)

So it turns out these in-app web views can't die quick enough (hello, SafariViewController!). Marty tweeted he was trying to get YouTube videos to open in the native iOS app rather than on the website but was finding it impossible. By default, the iOS app adds a URL scheme to open youtube.com links. When someone texts you a link to a video, Safari will redirect you to the app. However, Facebook's in-app browser (and Twitter's and I expect others) doesn't honour this and linking to the youtube:// URL scheme doesn't work either. Workaround With JavaScript It turns out, if…

Gulp, AngularJS and html5Mode

To make your AngularJS app feel a little nicer you've probably enabled html5Mode to remove the annoying hashbang from your URIs. However, this can present some issues when trying to test the site locally. And, unless you've been living under a rock for the past year you've no doubt heard of gulp — that new task runner that the cool kids ditched Grunt for. We can use it (along with another package) to serve our AngularJS app and get around the issues of testing locally. How? I'm going to assume you already have gulp installed, but if you don't take a…

Stop ng-repeat auto-sorting your objects in AngularJS 1.3

I was working on a project that called for an object to be used with ng-repeat. By default Angular orders this alphabetically but this wasn't what we wanted in the project at all. As it turns out there's no way to stop this in AngularJS 1.3 by default. However, this behaviour has been removed from 1.4, which is currently in beta. Thankfully it's not too difficult to stop this from happening in 1.3 too. How? In order to get this to work we need to grab our keys from the object and shove them into an array.…

Animating or transitioning view changes in AngularJS

Since AngularJS 1.2.0 we've had the ability to do native animations in Angular using CSS classes, transitions and keyframes. I've been working on a site recently where it called for transitions to be used between view changes heavily. Thankfully this is made really easy using the ngAnimate module. Prerequisites If you haven't already, go and fetch the ngAnimate module that matches your version of AngularJS from angularjs.org and pop this into your module's dependency list. ngAnimate We can set a global transition for all pages or set them per view which I think is much more interesting.…