This is a guide to porting Angular applications from Semantic UI to Bootstrap, following the ALMA UI Guidelines.
You'll be changing the front-end a lot, barely touching the back-end, if at all. Make sure
you configure the front-end such that it can be launched with npm install; ng serve -o
on port 4200 while the back-end runs on its customary port, typically around 10000.
In the case of the DRA Tool, for instance, that requires setting developmentMode = true
in app.globals.ts, which has the effect of changing resourceServerURL from /dra-tool
to http://localhost:10000/dra-tool.
Note Remember to undo this setting when you're done!
On the back-end side you'll need a CORS filter that maps the value of the Origin
request header to the Access-Control-Allow-Origin response header; plus assorted
other settings.
See OBOPS/dra-tool/src/main/java/alma/obops/dratool/security/SimpleCORSFilter.java
for an example.
Note This may conflict with the @CrossOrigin annotation of the controller
classes/methods, causing duplicated requests: make sure the filter is disabled when you're done! (Comment
out the @Component annotation on the CORS filter.)
See the Getting Started section of the ALMA UI Guidelines documentation for a description of how to set up Bootstrap, ALMA styles, fonts and icons.
NG Boostrap is a library allowing Bootstrap to be integrated with Angular applications.
To install it:
Add "@ng-bootstrap/ng-bootstrap": "<version>" to the
dependencies field of package.json, where version is ^5.1.5
for Angular 8.x.x
NOTE See here
for the version numbers.
In app.module.ts:
import {NgbModule, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'
then add NgbModule and NgbActiveModal to the imports and
providers arrays, respectively:
imports: [ ... NgbModule ... ],
providers: [ ... NgbActiveModal ... ],
SUI containers need to be changed to their Bootstrap equivalents. See Migrating Containers from Semantic UI for more info.
Library ng2-semantic-ui is the counterpart of ng-bootstrap for Semantic UI. Components written with the former must be rewritten to take advantage of the Angular/Bootstrap integration facilities.
To ease the migration, a CSS compatibility layer allows you to leave many SUI classes in place.
For <button> elements:
almacolor and red map to btn-primary and btn-danger, respectivelyui tiny compact button map to Bootstrap btn btn-smSee Migrating Checkboxes from Semantic UI.
See Migrating Datepicker from Semantic UI.
See Migrating Dropdown from Semantic UI.
See Migrating the Header Bar from Semantic UI.
See Migrating Icons from Semantic UI.
See Migrating Modals from Semantic UI.
See Migrating Popups from Semantic UI.
See Migrating Selects from Semantic UI.
See Migrating Tabsets from Semantic UI.
Replace SUI table definitions
<table class="ui basic table"> ... </table>
with the equivalent Bootstrap idiom
<table class="table table-bordered"> ... </table>
If the table has the selectable class, add table-hover in the bootstrap version.
Some steps below may not apply to your application.
ng2-semantic-ui from package.jsonSuiModule from app.module.ts