Last Updated: September 09, 2019
·
1.16K
· legittalon

Multiple Pages In Chrome Packaged Apps

The URL structure inside of Chrome Packaged Apps messes with the AngularJS $routeProvider.

As a solution one can use the following directive:

app.directive("link", function ($location) {
  function (scope, element, attrs) {
    element.bind("click", function () {
      scope.$apply($location.path(attrs.link))
    });
  }
});

This creates a custom link attribute to be used in the format of

<span link="yourRoute">This is a link that will match your /yourRoute</span>

1 Response
Add your response

I'm just getting started with AngularJS, but it seemed this only worked for me if I put "return " before "function" on L. 2 and a semicolon to terminate that return.

over 1 year ago ·