Is the $routeProvider not functioning properly on WindowsPhone 8 (phonegap) with AngularJs?

My brain is fried. I can't figure out what the issue is with my code.

Hmm, let me break it down for you.

File details:

Cordova version 2.9.1

AngularJS version 1.2.13 (also tested with the latest version 1.2.16)

Using Windows Phone 8 App

Here is the code snippet:

App.js

'use strict';
window.myApp = angular.module('myApp', ['ajoslin.mobile-navigate', 'ngMobile',
    'myApp.Registermdl',
   'myApp.login', 'myApp.CreateUsermdl', 'myApp.viewMap', 'myApp.createMap',
'myApp.logout', 'ngProgress', 'ngCookies','ngRoute'])


myApp.config(function ($routeProvider, $compileProvider) {

    $compileProvider.aHrefSanitizationWhitelist(/^\s*(http?|ftp|mailto|file|tel):/);

    $routeProvider.when('/', { templateUrl: 'index.html', controller: 'IndexCtrl' });
    $routeProvider.when('/login', { templateUrl: 'app/login/login.html', controller: 'LoginCtrl' });
    $routeProvider.when('/home', { templateUrl: 'app/home/home.htm', controller: 'HomeCtrl' });
    // rest of the route configurations...
});

// IndexCtrl function...

var hostname = 'localhost:54938/';
var rootUrl = 'http://' + hostname;

and index page (main page)

<!DOCTYPE html>
<html xmlns:ng="http://angularjs.org" lang="en" ng-app="myApp">
<head>
    <!-- Head content -->
</head>

<body>
    <!-- Body content -->
</body>

</html>

The code works smoothly on all browsers, except in the Emulator. I've tried numerous solutions without success.

I sought help on Stack Overflow and someone suggested adding this line of code:

$compileProvider.aHrefSanitizationWhitelist(/^\s*(http?|ftp|mailto|file|tel):/);

Although I have already implemented it, the issue persists. It seems to be related to $routeProvider not functioning correctly in the emulator (leading to a redirection problem).

I'm unsure if it's a version conflict or some other technical glitch...

Can Anyone Assist Me?

Answer №1

For resolving the issue with angularjs routing in the Windows mobile application, include "ms-appx" to make it safe: ms-appx://.

$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|ms-appx):/)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the process for incorporating a new task into my HTML/CSS/JavaScript to-do list application when the Enter key is pressed?

Currently, I am working on developing a to-do list application using HTML, CSS, and JavaScript. The application includes a text input field for users to enter their tasks, along with an "Add Task" button. However, I want to enhance the user experience by a ...

Angular 6: Dealing with Type Errors in the HttpClient Request

I am encountering issues with my services. I am attempting to retrieve a list of media files (generated by NodeJS, which generates a JSON file containing all media items). Although I can successfully fetch the data, I am facing an error stating "Property & ...

I am frustrated because the csvtojson converter keeps replacing my file name with "undefined."

Despite running the csvtojson module on node.js successfully without any additional code, I encounter an issue when attempting to include it within a function. The result returns as undefined, even though the file path remains intact. Check out the JavaSc ...

Having trouble toggling the navbar on and off in mobile. Error message: Unable to read parentnode of undefined

When I try to make my mobile navbar full screen on a mobile device, the hamburger button works as expected when clicked. Initially, all the links are displayed in full page view, but once I click on a link, it disappears and takes me to the respective sect ...

Looking for a solution to a problem with your vertical CSS/jQuery dropdown menu

My web app features a vertical CSS menu that is working correctly except for one minor issue. When I mouse out on all elements with the class a.menutoggle, the last dropdown menu remains open. I am struggling to find a solution to hide it. Can someone plea ...

changing button text in ajax upon successful completion

I am looking to update the button text upon successful completion. Specifically, I would like to change it to "accepted" after a successful response. <button type="button" onclick="saveData<?php echo $row1->id; ?>()">Accept</button> ...

Exploring the method to retrieve key value pairs within an array object using JavaScript

I have an array of JSON objects and I am trying to extract it as key-value pairs. Here is the code snippet: var fs = require('fs'); var parameters = { 'Tenantid': 'a62b57-a249-4778-9732', "packagecategoryn ...

Updating a deeply nested value with React's setState

Dealing with a deeply nested object in my React state has been quite the challenge. The task at hand is to modify a value within a child node. Fortunately, I have already identified the path leading to the node that needs updating and I am utilizing helper ...

What causes the image to not appear at the center bottom of the page when using IE for loading?

Why does the loading image not appear at the center bottom of the page in IE? This function loads content when the page is loaded and also loads content when scrolled to the bottom. When you load the page index.php, you will see the loading image at the ...

Click on the window.location.href to redirect with multiple input values

I am facing a challenge with my checkboxes (from the blog label) and the code I have been using to load selected labels. However, this code seems to only work for one label. Despite multiple attempts, I have found that it only functions properly with one ...

Add the hue value from Hue into the Chromajs HSL state value

My objective is to dynamically change the background color of a div based on user input. I plan to assign the user's input as the value of the state key hue, and then set another state key called color to hold the HSL representation of the hue using C ...

Eliminate the jQuery AJAX timestamp from the URL parameters

Is there a way to eliminate the jQuery AJAX cache buster code (_=3452345235) from string URLs? While working on a global AJAX fail handler, I need to identify which URL failed. However, every time I locate the failed request's URL, the jQuery cache q ...

Displaying server errors in an Angular componentIn this tutorial, we

As I work on creating a registration page, my focus has been on posting data to the server. I have successfully implemented client-side and server-side validation mechanisms. Managing client-side errors is straightforward using code such as *ngIf="(emailAd ...

Is there a way to retrieve data from both JSON and a file simultaneously?

I'm trying to use JavaScript fetch API to upload a photo message with text to Discord webhook. How can I upload both my JSON data and file? var discordWebHookBody = new FormData() discordWebHookBody.append("map", map) discordWebHookBody.appe ...

The JavaScript code is producing a numerical output instead of the intended array

I am facing an issue with my program that is designed to eliminate items from a list of arguments. function destroyer(arr) { var args = [].slice.call(arr); var data = args.shift(); for(var i = 0; i < args.length; i++){ var j = 0; while(j ...

Issue with React's MaterialUI Select Component not displaying the values passed as props

In my component, I have a FormControl element that includes a Select element accepting an array of options for MenuItem options, as well as a value as props. The component code looks like this: const TaxonomySelector = (props) => { const { isDisabled, t ...

componentWillReceiveProps with excessive conditional statements

Having recently ventured into React development, I've already worked on 3 major projects utilizing React+Redux. However, I've noticed a recurring pattern that I find quite displeasing: componentWillReceiveProps(nextProps) { if (nextProps.par ...

Wait to display the page until receiving a response from the $http.get request

Currently, I am incorporating AngularJS in my website. However, when running it on my local server, it requires data from a remote server through the '$http.get' method, resulting in a delay of 3-4 seconds. This leads to an unattractive appearanc ...

What are the risks of employing conditional rendering in react-router-dom for authentication purposes?

In the following code snippet: If the authentication data sent from the client matches in the backend, a response with the user ID is sent. If setIsAuth sets to true, the Layout Component will display the first case within the Switch component, allowin ...

Inject props into a Component nested within a Higher-Order-Component (HOC)

In attempting to grasp the concept of creating a React Higher Order Component from this particular article, I find myself struggling to fully understand and utilize this HOC. interface PopupOnHoverPropType { hoverDisplay: string; } const WithPopupOnHov ...