Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Angular Material in a normal html page

I am new to Angular and I was wondering if it was possible to use angular form directives (tags?) like mat-error, mat-form-field, mat-button, etc in a normal html page; i mean not as a part of nodejs application. For example by adding the necessary css and js files in the head section of the html page.

I have spend hours to find an example on the net without any success. All examples I found are in combination of npm and nodejs. so I appreciate any suggestion.

By to way I am aware of the possibility of Angular tags discussed here: https://material.angularjs.org/latest/demo/input but this is not what I am looking for.

like image 800
hbourchi Avatar asked Jun 21 '26 08:06

hbourchi


1 Answers

If you want to use material components with pure HTML, you can have a look at other material frameworks, like MUI or Materialize, where you can simply import the JS file from a CDN and have access to all the usual components.

For example, this is a very basic template built with MUI, where the only thing you need is some HTML.

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- load MUI -->
    <link href="//cdn.muicss.com/mui-0.9.39-rc1/css/mui.min.css" rel="stylesheet" type="text/css" />
    <script src="//cdn.muicss.com/mui-0.9.39-rc1/js/mui.min.js"></script>
  </head>
  <body>
    <!-- example content -->
    <div class="mui-container">
      <div class="mui-panel">
        <h1>My Title</h1>
        <button class="mui-btn mui-btn--primary mui-btn--raised">My Button</button>
      </div>
    </div>
  </body>
</html>
like image 131
bugs Avatar answered Jun 23 '26 23:06

bugs