GithubHelp home page GithubHelp logo

sap-samples / ui5-webcomponents-sample-angular Goto Github PK

View Code? Open in Web Editor NEW
36.0 14.0 12.0 11.97 MB

UI5 Web Components Sample TODO application built with Angular.

Home Page: https://sap-samples.github.io/ui5-webcomponents-sample-angular/

License: Apache License 2.0

Shell 0.01% JavaScript 73.07% TypeScript 1.17% CSS 25.25% HTML 0.51%
ui5 ui5-webcomponents angularjs sample sample-code

ui5-webcomponents-sample-angular's Introduction

UI5 logo CI REUSE status

UI5 Web Components Angular Sample Application

Angular sample application to demonstrate the usage of the UI5 Web Components. It shows how to bind properties, to subscribe to events, using nested components and the bootstrapped Angular build.

This project was bootstrapped with Angular CLI.

Prerequisites

  • Node.js (version 8.5 or higher ⚠️)

Getting started

  1. Clone this repository using the GitHub Command line tool and navigate into the downloaded directory.

    git clone https://github.com/SAP-samples/ui5-webcomponents-sample-angular.git
    cd ui5-webcomponents-sample-angular
  2. Install all dependencies

    npm install
  3. Start a local server and run the application. (The running application can be found here: http://localhost:4200)

    npm start

Browser support

Currently Chrome, Safari, Edge and Firefox support Web Components natively.

Noteworthy

Consume UI5 Web Components

Import the desired component(s) in your app to define the UI5 Web Component.

For example, to use ui5-button you need to import it:

import "@ui5/webcomponents/dist/Button"; // loads ui5-button

Then, you can use the custom element in an HTML page:

<ui5-button>Hello world!</ui5-button>

Configure events

A custom configuration for UI5 Web Components should be provided in the html:

<script data-id="sap-ui-config" type="application/json">
  {
    "xx-wc-no-conflict": {
      "events": "press"
    }
  }
</script>

Than press event for ui5-button, ui5-togglebutton, ui5-icon and ui5-link should be attached with (ui5-click) instead of (click)

Configure Angular Build

When UI5 Web Components are used they include all of their translation files and CLDR data files in the application bundle. In order to decrease the bundle size of the application a custom Webpack configuration should be provided.

You can follow the steps described by this article.

The content of the webpack.partial.js file should be:

webpack.partial.js

module.exports = {
    module: {
      rules: [
        {
          test: [/cldr\/.*\.json$/, /i18n\/.*\.json$/],
          loader: 'file-loader',
          options: {
            name: 'static/media/[name].[hash:8].[ext]',
          },
          type: 'javascript/auto'
        }
      ]
    }
};

Where is the npm package?

Limitations

No limitations known.

Known Issues

No major bugs known.

Support

We welcome all comments, suggestions, questions, and bug reports. Please follow our Support Guidelines on how to report an issue, or chat with us in the #webcomponents channel of the OpenUI5 Community Slack.

Contribute to UI5 Web Components

Please check our Contribution Guidelines.

ui5-webcomponents-sample-angular's People

Contributors

adrian-bobev avatar dependabot[bot] avatar fifoosid avatar hinzzx avatar ilhan007 avatar mapto0 avatar mmoudy49 avatar petermuessig avatar vladitasev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ui5-webcomponents-sample-angular's Issues

Edit dialog doesn't open

There's a bug in app.component.ts, line #81 where this.oDialog.nativeElement.open() is called. It should be .show() instead of open().

Failing to compile with default

Following the instructions, however when building using npm start

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@ui5/webcomponents-base/dist/features/browsersupport/Edge' in '/Users/Documents/sap/upscale/ui5-webcomponents-sample-angular/src/app'
ℹ 「wdm」: Failed to compile.

Remarking out the following line in app.module.ts, allows compile:
// import "@ui5/webcomponents-base/dist/features/browsersupport/Edge";

Maybe just update the documentation or have it commented out by default and those that use Microsoft Browsers can enable.

Two-way data binding

Thank you for all three sample apps (angular, react, vue), really helpful in evaluations and discussions,

Would it be possible to extend all three apps, with the two-way binding, even the simplest way?

Like for example: two text fields and one checkbox, which can be edited in UI, for view to model changes.
And one button, with the click logic to swap the text fields’ bound data values and toggle the checkbox bound data value, for model to view changes?

The reason I am asking is that two-way binding looks like a kind of challenge.

Angular tutorial

You can use two-way data binding with the following components: CheckBox, RadioButton, Input, DatePicker, Switch, TextArea. In order to use it, you have to use a library called Origami ...

React tutorial

Data binding not mentioned at all, only event binding. There are more possibilities in React, one could be shown as example.

Vue tutorial

v-model binding doesn’t work as expected for custom elements. In order to use two way data binding, you should bind and update the value yourself like this

<ui5-input
    :value="inputValue"
    @input="inputValue = $event.target.value">
</ui5-input>

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.