I am giving a basic study on how to create screens using Angularjs and Material, everything going well until I need the controller, it seems that $ scope is not working, I put a console.log at the beginning of the controller and it prints the text, but values set to $ scope are not applied to the screen and functions called using ng-click are not executed either.
<body ng-app="App" layout="column" ng-controller="PageController as pc">
<md-toolbar layout="row" layout-align="start center">
<md-button class="menu" ng-click="pc.toggleMenu()">
<i class="material-icons">menu</i>
</md-button>
<h1>Angular Material</h1>
</md-toolbar>
<div class="container" layout="row" style="min-height: 100%;">
<md-sidenav md-is-locked-open="$mdMedia('gt-sm')" class="md-whiteframe-4dp" flex="20" md-component-id="left">
{{pc.sidenav}}
</md-sidenav>
<md-content id="content" flex>
<md-button class="md-raised">BUTTON</md-button>
<md-button class="md-raised md-primary">BUTTON</md-button>
<md-button class="md-raised md-accent">BUTTON</md-button>
<md-button class="md-raised md-warn">BUTTON</md-button>
</md-content>
</div>
<!-- Angular Material requires Angular.js Libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script><scriptsrc="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><scriptsrc="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><scripttype="text/javascript">
angular.module('App', ['ngMaterial'])
.controller('PageController', function($scope, $mdSidenav){
console.log('Aparece no console!');
$scope.sidenav = "Sidenav";
$scope.toggleMenu = function() {
console.log('toggleMenu');
$mdSidenav('left').toggle();
};
})
.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default')
.primaryPalette('blue')
.accentPalette('orange')
.warnPalette('deep-orange').dark();
});
</script>
</body>
The .config and console.log () in the .controller work, only the $ scope that is not working.