1

I'm pretty new to angularjs and angular material, and I was wondering why my md-button might not be showing up the way it should on my browser but worked on codepen. I put this in my html file:

<html ng-app='app'>
<head>
  <!-- Angular Material requires Angular.js Libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js"></script>

<!-- Angular Material Library -->
<script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js"></script>
<script src='app.js'></script>
</head>

<body ng-controller='MainCont'>
<md-button class='md-primary'>hello</md-button>
</body>
</html>

app.js:

var app = angular.module('app', ['ngMaterial']);

app.controller('MainCont', function(){
});

The module and the controllers are all loading, but in the browser this button shows up like this:

button picture here

Can someone explain to me why this might be? Thanks so much!

4
  • Well... what are you expecting?? Commented Jul 16, 2016 at 23:10
  • I'm expecting the flat buttons like on the demos from angular material here: material.angularjs.org/latest/demo/button Commented Jul 16, 2016 at 23:45
  • Then you need to add the classes that they're using, for ex: class="md-raised md-primary md-button md-ink-ripple". Commented Jul 16, 2016 at 23:48
  • Even if I add "md-no-ink" like the second example, the button doesn't change to look like the one in the example. Commented Jul 16, 2016 at 23:51

1 Answer 1

2

You just forgot to import the css of AngularMaterial:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.1.0-rc2/angular-material.min.css">
Sign up to request clarification or add additional context in comments.

2 Comments

Oh that was a pretty dumb mistake, thanks for your help!!
Pleasure to help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.