vaadin/base-starter-angular

Name: base-starter-angular

Owner: Vaadin

Description: Base Starter for Vaadin components with Angular

Created: 2018-01-23 08:17:52.0

Updated: 2018-05-10 06:08:36.0

Pushed: 2018-05-09 12:57:02.0

Homepage: https://vaadin.com/start

Size: 286

Language: TypeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Base Starter for Vaadin components with Angular

Instructions
Install all dependencies

Run bower install to install all the necessary dependencies. After this you can run the development server.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Recreating this project

This project was generated with Angular CLI version 1.6.5 with additional steps to include bower dependencies. You can recreate the project by following along these steps:

First install npm Then install Bower:

m install -g bower
bash
m install -g @angular/cli
 new hello-angular
 hello-angular

 will use a third-party helper library https://github.com/hotforfeature/origami
m install --save @codebakery/origami
wer init
ep everything default

t > .bowerrc
rectory": "src/assets/bower_components"}
+D

wer install --save Polymer/polymer
wer install --save vaadin-core

If you'd like to not commit bower dependencies to your version control, add src/assets/bower_components to .gitignore.

Open src/index.html and add the following in the <head> section:

ipt src="assets/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
k rel="import" href="assets/bower_components/vaadin-button/vaadin-button.html">
k rel="import" href="assets/bower_components/vaadin-text-field/vaadin-text-field.html">

Open src/main.ts In the import section, add:

rt { webcomponentsReady } from '@codebakery/origami';
Wrap `platformBrowserDynamic` code with:
omponentsReady().then(() => {
atformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
atch(error => {
 No WebComponent support and webcomponentsjs is not loaded
nsole.error(error);

Open src/app/app.module.ts

Update the `import` section:
rt { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
rt { PolymerModule } from '@codebakery/origami';

Inside the @NgModule definition, add:

mas: [CUSTOM_ELEMENTS_SCHEMA],

Inside the @NgModule definition, add this to the imports array:

merModule.forRoot(),

Open src/app/app.component.html and replace all the HTML code with:

din-text-field id="text" placeholder="Type Something"></vaadin-text-field>
din-button (click)='clicked()'>Click Me!</vaadin-button>
Hello {{title}}!</h2>

Open src/app/app.component.ts and define the click event inside the class:

ked() {
is.title = document.getElementById('text')['value'];


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.