I'm experimenting with chrome packaged apps, my first screen has a list of items, when i click on an item, a detail page should be visible.
I a normal web app you just do:
<a href="#/detail/{{item.name}}">{{item.name}}</a>
But in a packaged app i get the following error:
Can't open same-window link to "unsafe:chrome-extension://fsdjiojkljkljdfijkjkijkjkjijikf/index.html#/detail/blablabla"; try target="_blank".
So how do i do some kind of navigation in a chrome packaged app?
Thanks
You can find Angular DevTools in the Chrome Web Store and in Firefox Addons. After installing Angular DevTools, find the extension under the Angular tab in your browser DevTools. Lets you explore the components and directives in your application and preview or edit their state.
Overview. The $location service parses the URL in the browser address bar (based on the window. location) and makes the URL available to your application. Changes to the URL in the address bar are reflected into $location service and changes to $location are reflected into the browser address bar.
AngularJS extends HTML with ng-directives. The ng-app directive defines an AngularJS application. The ng-model directive binds the value of HTML controls (input, select, textarea) to application data. The ng-bind directive binds application data to the HTML view.
As pointed by @romario333, see https://stackoverflow.com/a/15769779/122441 :
You need to explicitly add URL protocols to Angular's whitelist using a regular expression. Only http
, https
, ftp
and mailto
are enabled by default. Angular will prefix a non-whitelisted URL with unsafe:
when using a protocol such as chrome-extension:
.
A good place to whitelist the chrome-extension:
protocol would be in your module's config block:
var app = angular.module( 'myApp', [] )
.config( [
'$compileProvider',
function( $compileProvider )
{
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension):/);
// Angular before v1.2 uses $compileProvider.urlSanitizationWhitelist(...)
}
]);
The same procedure also applies when you need to use protocols such as file:
and tel:
.
Please see the AngularJS $compileProvider API documentation for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With