Angular routing in JavaScript® based Windows® Store apps

To be able to run Angular core and route modules in Windows® 8/8.1 Store single page applications based on JavaScript®, follow these steps:

  1. To resolve innerHTML and related security issues from internal calls of JQuery or AngularJS, get winstore-jscompat.js file from Microsoft Open Technologies running before all other scripts in your application;
  2. To resolve issues with unsafe URLs with (otherwise) unsafe “ms-appx” scheme references, ensure you add an appropriate $compileProvider.aHrefSanitizationWhitelist call in your module’s configuration method (you may enable other needed schemes as well):

var myApp = angular.module(“myApp”, [“ngRoute”, …]);
mainApp.config([“$routeProvider”, “$compileProvider”,
    function ($routeProvider, $compileProvider) {
        $routeProvider.when(…)[.…].otherwise(…);
        $compileProvider.aHrefSanitizationWhitelist(
            /^\s*(https?|ftp|mailto|file|ms-appx):/);
}]);

Advertisements

About Sorin Dolha

My passion is software development, but I also like physics.
This entry was posted in HTML5, JavaScript and tagged , , , , . Bookmark the permalink.

Add a reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s