0

Has anyone used AngularJS for Chrome extensions ?

What should be the strategy if I want to insert a div in a page from which I should be able to define my layout and structure.

I also don't want to mess-up with the page if it has already declared any parent element as ngApp, considering that web page is also using Angular.

Or should I inject an iframe in which I load my app ?

1 Answer 1

3

Yes, this is possible. You would have to inject angularjs along with your code into each window.

If you don't want to mess up any existing angular code, you should use an iframe. If you need to grab values from the web page and put them into the iframe and are worried about cross-domain issues, you can get values from the webpage and pass them through the chrome extension into your iframe.

If you don't want to use an iframe, you can also check if the page has the ng-app directive, and if so, the code you insert (the div) has an ng-controller along with the angular code, so it can 'piggy-back' off of the main angular app.

Sign up to request clarification or add additional context in comments.

1 Comment

how can it piggy-back off main angular app? Can we inject a div with same ng-controller?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.