Recently, I've been delving into Angularjs with angular-material and encountered a slight issue with ng-href. I created a Toolbar at the top of my webpage, but the moment I include the "ng-href" attribute to a button, the text inside the Button loses its center alignment:
The first two Buttons have the ng-href tag applied. However, the third one does not. Besides that, they are identical.
angular.module('angular2',['ngRoute','ngMaterial','ngMessages'])
.config(function ($mdThemingProvider,$routeProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('blue')
.accentPalette('blue');
$routeProvider
.when("/", {
templateUrl : "main.html"
})
.when("/test1", {
templateUrl : "test1.html"
})
.when("/test2", {
templateUrl : "test2.html"
})
})
.controller('mainCtrl',function ($scope, $http, $mdDialog) {
})
;
.navButton{
font-weight: bold;
margin: 0px;
height: inherit;
width: 150px;
border-radius: 0px;
text-transform: none;
border: solid;
}
<!DOCTYPE html>
<html lang="en" ng-app="angular2">
<head>
<meta charset="UTF-8>
<title>Angular 2</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="app.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js></script>
<script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js></script>
<script src="app.js"></script>
</head>
<body ng-controller="mainCtrl>
<div layout="column>
<md-toolbar class="md-menu-toolbar" style="height: 64px">
<div layout="row" style="height: inherit">
<md-toogle-filler flex="5" style="height: inherit"" layout layout-align="center center">
<md-icon class="material-icons md" style="font-size: 48px; height: 48px; width: 48px">>mail_outline
</md-icon>
</md-toogle-filler>
<div flex layout="row" layout-align="start center" style="height: inherit">
<md-button class="md-primary navButton" ng-href="#/">Main</md-button>
<md-button class="md-primary navButton" ng-href="#/test1">(First Test)</md-button>
<md-button class="md-primary navButton">(Second Test)</md-button>
</div>
</div>
</md-toolbar>
<div ng-view></div>
</div>
</body>
</html>
I'm having trouble centering the text within the buttons after adding the ng-href attribute.