42213

IBM Mobile First Platform (6.3) - Windows Phone 8 environment and Angularjs

Question:

I create demo app using angularjs (+ angular-ui-router) to develop and build to android, ios, windows phone 8 environment. Everythings works fine on android, ios and mobile web simulator, but on windows phone device it doesn't show my custom directive. I use visual studio express 2012 for windows phone to build.

in index.html:

<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>test</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <!-- <link rel="shortcut icon" href="images/favicon.png"> <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> --> <link rel="stylesheet" href="css/main.css"> <script>window.$ = window.jQuery = WLJQ;</script> </head> <body style="display: none;" ng-controller="demoController"> <!--application UI goes here--> <div ui-view></div> <script src="js/libs/angular.js"></script> <script src="js/libs/angular-ui-router.js"></script> <script src="js/app.js"></script> <script src="js/initOptions.js"></script> <script src="js/main.js"></script> <script src="js/messages.js"></script> </body> </html>

In main.js:

var PATH = ""; function wlCommonInit(){ if (WL.Client.getEnvironment() == WL.Environment.WINDOWS_PHONE_8) { PATH = "/www/default/"; } // Common initialization code goes here angular.element(document).ready(function() { angular.bootstrap(document, ['app']); }); }

in app.js:

(function() { angular.module('app', ['ui.router']) // config route .config(function($stateProvider) { $stateProvider .state('home', { url: '/home', templateUrl: PATH + 'js/templates/home.html' }); }) // custom directive .directive('mHeader', function() { return { templateUrl: PATH + 'js/templates/header.html' }; }) // demo controller .controller('demoController', function($state) { $state.go('home'); }); })();

in home.html:

<div m-header></div> <div>this is home page</div>

in header.html:

<div>this is header</div>

In Visual Studio output view from debug:

'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{42B9E91D-5EEE-40E2-8162-FDBCC185DADB}\Install\example.DLL'. Symbols loaded. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{42B9E91D-5EEE-40E2-8162-FDBCC185DADB}\Install\WLWPNativeLib.DLL'. Cannot find or open the PDB file. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{42B9E91D-5EEE-40E2-8162-FDBCC185DADB}\Install\worklight-windowsphone8.DLL'. Cannot find or open the PDB file. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.Interop.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.Serialization.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\WinMetadata\Windows.winmd'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.Linq.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{42B9E91D-5EEE-40E2-8162-FDBCC185DADB}\Install\WPCordovaClassLib.DLL'. Cannot find or open the PDB file. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Core.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ServiceModel.Web.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols. The thread 0xc98 has exited with code 259 (0x103). An exception of type 'System.NotSupportedException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary The thread 0x840 has exited with code 259 (0x103). The thread 0xa3c has exited with code 259 (0x103). An exception of type 'System.SystemException' occurred in Microsoft.Phone.Interop.ni.dll and wasn't handled before a managed/native boundary The thread 0xe34 has exited with code 259 (0x103). An exception of type 'System.NotSupportedException' occurred in Microsoft.Phone.ni.dll and wasn't handled before a managed/native boundary The thread 0x904 has exited with code 259 (0x103). The thread 0xd78 has exited with code 259 (0x103). The thread 0xd0c has exited with code 259 (0x103). The thread 0xb08 has exited with code 259 (0x103). The thread 0x8b0 has exited with code 259 (0x103). The thread 0xe1c has exited with code 259 (0x103). An exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary The thread 0x44c has exited with code 259 (0x103). The thread 0x460 has exited with code 259 (0x103). 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{42B9E91D-5EEE-40E2-8162-FDBCC185DADB}\Install\Newtonsoft.Json.DLL'. Cannot find or open the PDB file. The thread 0x4b4 has exited with code 259 (0x103). 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Dynamic.Runtime.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Linq.Expressions.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ObjectModel.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.IO.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Collections.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Globalization.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.Extensions.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The thread 0x364 has exited with code 259 (0x103).

Answer1:

The IE on Windows Phone does not allow resource injection. Adding all assignments within MSApp.execUnsafeLocalFunction(); solves most of the jQuery and Angular JS problems. As shown below..

<pre class="lang-html prettyprint-override">MSApp.execUnsafeLocalFunction(function () { element.innerHTML = value; });

Recommend

  • Rendered partial view does not match model
  • Combine multiple unique MySQL tables and order by one column
  • Cuda Clang and OS X Mavericks
  • Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)
  • CakePHP ACL tutorial initDB function warnings
  • how to upload multiple files in c# windows application
  • MS Access - How to change the linked table path by amend the table
  • JBoss External Properties Files in Classpath
  • Connect .sks to skscene.h
  • Display images in Django
  • Is there a way to do normal logging with EureakLog?
  • Sencha Touch 2.0 Controller refs attribute not working?
  • Why does access(2) check for real and not effective UID?
  • Checking free space on FTP server
  • FileReader+canvas image loading problem
  • Change JButton Shape while respecting Look And Feel
  • Insert into database using onclick function
  • Deselecting radio buttons while keeping the View Model in synch
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Resize panoramic image to fixed size
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • script to move all files from one location to another location
  • Sending data from AppleScript to FileMaker records
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • Importing jscolor library in angular 2
  • jQuery tmpl and DataLink beta
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • bootstrap to use multiple ng-app
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to include full .NET prerequisite for Wix Burn installer
  • using HTMLImports.whenReady not working in chrome
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Getting Messege Twice Using IMvxMessenger
  • Authorize attributes not working in MVC 4
  • Is it possible to post an object from jquery to bottle.py?
  • EntityFramework adding new object to nested object collection
  • Binding checkboxes to object values in AngularJs
  • Unable to use reactive element in my shiny app
  • How to load view controller without button in storyboard?