问题描述:

I am getting the following error for ng-include

 Token ':' is an unexpected token at column 17 of the expression [chrome-extension://iikdmhjdakcicmdogkpcfcnlmacgggnj/templates/profile.html]

starting at [://iikdmhjdakcicmdogkpcfcnlmacgggnj/templates/profile.html]

I have added the profile.html in the manifest and can access it via the url chrome-extension://iikdmhjdakcicmdogkpcfcnlmacgggnj/templates/profile.html

What could be the reason for this? Please let me know how to fix this?

EDIT:

I have tried referencing the template file by both

<div ng-include="'+chrome.extension.getURL("templates/profile.html")+'">

and

<div ng-include="/templates/profile.html" ></div>

网友答案:

I suppose this is how your ng-include looks like:

<ng-include src="chrome-extension://iikdmhjdakcicmdogkpcfcnlmacgggnj/templates/profile.html"></ng-include>

If it is true that you included "chrome-extension://+extensionId" in the url, remove it. Let the ng-include look like this:

<ng-include src="/templates/profile.html"></ng-include>

Also, include the "/templates/profile.html" in the manifest's web_accessible_resources, like this:

//manifest
{
  ...
  "web_accessible_resources": [
    "/templates/profile.html"
  ],
  ...
}
相关阅读:
Top