Giter Club home page Giter Club logo

Comments (3)

niveo avatar niveo commented on September 27, 2024 1

angular: 2.1.2
angular-cli: 1.0.0-beta.21

import { PolymerElement } from '@vaadin/angular2-polymer';
export class Polymer {
    static forRoot() {
        return [
            PolymerElement('paper-button'),
            PolymerElement('paper-checkbox'),
            PolymerElement('paper-input')
        ]
    }
}
@NgModule({
  imports:      [],
  declarations: [Polymer.forRoot()],
  exports:      [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ComponentModule1 { }

@NgModule({
  imports:      [],
  declarations: [Polymer.forRoot()],
  exports:      [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ComponentModule2 { }

from angular-polymer.

platosha avatar platosha commented on September 27, 2024

Hi, thanks for asking. Currently there is no way of passing arrays.

As I think, we have to replace the PolymerElement function with something else anyway. Maybe we can solve this repetitive declaration issue at the same time with #86.

from angular-polymer.

praveenpuglia avatar praveenpuglia commented on September 27, 2024

I like the solution but it forces me to load all three polymer elements in both the modules which generally isn't the case. In some modules i may require all three of them and in some just one of them.

This however gave me an idea to make this parameterized the following way.

import { PolymerElement } from '@vaadin/angular2-polymer';
export class Polymer {
    static load(elements) {
        return elements.map( v => PolymerElement(v) )
    }
}

and then...

@NgModule({
  imports:      [],
  declarations: [Polymer.load(['paper-card','paper-checkbox'])],
  exports:      [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ComponentModule1 { }

@NgModule({
  imports:      [],
  declarations: [Polymer.load('paper-dropdown-menu')],
  exports:      [],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ComponentModule2 { }

I have not tested it yet. Awaiting comments.

from angular-polymer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.