Is there a way to run my angularJS app as a polymer component?

I am looking for a way to include an asynchronously angular application with its own styles and views included in JS in a Polymer component. Make some iframe


If you have any ideas, suggestions or real-life examples, that would be very helpful!


source to share

1 answer

Finally I found a solution myself. You just need to load the angular app into a specific element to avoid conflicts if more than one app is running in it. And implemented the ajax call script.


<link rel="import" href="../polymer/polymer.html">

<!-- Defines element markup -->
<dom-module id="my-element">
    <div id="my-app">   
<!-- Registers custom element -->
    is: 'my-element',

    // Fires when an instance of the element is created
    created: function() {},

    // Fires when the local DOM has been fully prepared
    ready: function() {

    // Fires when the element was inserted into the document
    attached: function() {},

    // Fires when the element was removed from the document
    detached: function() {},

    // Fires when an attribute was added, removed, or updated
    attributeChanged: function(name, type) {}


In this case angular will start loading the app in the element my-app

. And we can deploy separately the angular app and hold it in a polymer container. This gives us flexibility and page loading speed.



All Articles