Search code examples
angularjstypescriptangularjs-material

Converting Angular Materials to TypeScript


I am just learning AngularJS and I have followed the tutorials that use primarily TypeScript. I now want to use Angular Materials in my app and the component I need is written in JS.

From https://material.angularjs.org/latest/demo/slider#vertical

angular.module('sliderDemo2', ['ngMaterial'])

.controller('AppCtrl', function($scope) {

  $scope.vol = Math.floor(Math.random() * 100);
  $scope.bass = Math.floor(Math.random() * 100);
  $scope.master = Math.floor(Math.random() * 100);
});

What does this look like converted to TypeScript?


Solution

  • If you are learning Angular (not AngularJS) simply use Angular Materials for Angular 2/4 and it will be written in typescript: https://material.angular.io/components/slider/overview