Jaison James
Jaison James

Reputation: 4552

How set default value for angular material design slider?

I facing one issue while doing a app with angular material design, when using a slider there is no attribute for set default value. currently there is some attribute like 'step', 'min' and 'max'. I looking for a attribute like 'default', so I can set default value between the range for an on load. Please suggest a solution.

<md-slider md-discrete ng-model="myDiscreteValue" step="10" min="10" max="130">

Upvotes: 2

Views: 4528

Answers (2)

alicona
alicona

Reputation: 140

Try the following, set your $scope.myDiscreteValue to the value you want by default.

.controller('YourController', ['$scope', function ($scope) {
    $scope.myDiscreteValue = 5; //Will set the slider to a value of 5
}]);

Upvotes: 0

Starscream1984
Starscream1984

Reputation: 3062

I think you just need to give your scope's myDiscreteValue variable a value when your controller is loading.

Upvotes: 3

Related Questions