Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Material wont apply styles

I got a problem when I try to use Angular Material design. It wont style anything.

This is my HTML:

<!DOCTYPE html>
<html ng-app>
<head lang="en">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <title>Test</title>

    <link rel="stylesheet" href="./libs/css/angular-material.css"/>

    <script src="./libs/js/angular.js"></script>
    <script src="./libs/js/angular-aria.js"></script>
    <script src="./libs/js/angular-animate.js"></script>
    <script src="./libs/js/hammer.js"></script>
    <script src="./libs/js/angular-route.js"></script>
    <script src="./libs/js/angular-resource.js"></script>
    <script src="./libs/js/angular-material.js"></script>
</head>

<body>
    <md-button>asd</md-button>
</body>
</html>

Is there anything I'm missing?
angular-material.js is the file from bower install
angular-material.css is also

like image 715
LG87 Avatar asked Oct 31 '22 11:10

LG87


1 Answers

<html ng-app="app">
<head lang="en">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <title>Test</title>

    <link rel="stylesheet" href="./libs/css/angular-material.css"/>
<link rel="stylesheet" href="./libs/themes/purple-theme.css">
            <link rel="stylesheet" href="./libs/themes/blue-grey-theme.css">
    <script src="./libs/js/angular.js"></script>
    <script src="./libs/js/angular-aria.js"></script>
    <script src="./libs/js/angular-animate.js"></script>
    <script src="./libs/js/hammer.js"></script>
    <script src="./libs/js/angular-route.js"></script>
    <script src="./libs/js/angular-resource.js"></script>
    <script src="./libs/js/angular-material.js"></script>
 <script>
 var app = angular.module('app', 
  [

      "ngAnimate",
      "ngSanitize", 
      "ngMaterial"
  ]);
 </script>




</head>




<body>
    <md-button>asd</md-button>
</body>
</html>

If this didn't work, you might have wrong paths or maybe a newer Version. To check it, look in your angular-material folder. Do you have a "theme" folder? The new version does not have one. Remove the newer version and take an earlier version.

If you can handle a bit with shell you can try these :

bower install
bower uninstall angular-material
bower install angular-material

good luck!

like image 188
alox wagnor Avatar answered Nov 11 '22 13:11

alox wagnor