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.
- Node.js (version 8.5 or higher
⚠️ )
-
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
-
Install all dependencies
npm install
-
Start a local server and run the application. (The running application can be found here: http://localhost:4200)
npm start
Currently Chrome, Safari, Edge and Firefox support Web Components natively.
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>
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)
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'
}
]
}
};
No limitations known.
No major bugs known.
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.
Please check our Contribution Guidelines.