How to Variable Width in ng-style

Asked 2 years ago, Updated 2 years ago, 66 views

http://kimagureneet.hatenablog.com/entry/2015/01/19/050000
I am referring to the above page.

ng-style="{width:'400px'}"

How should I write this '400px' as a variable?

javascript angularjs

2022-09-30 17:16

1 Answers

If you register properties with $scope in the controller, you can configure them with {{property name}}.

JavaScript

$scope.widthValue="'400px'";

HTML

<div ng-style="{width:{{widthValue}}}">


2022-09-30 17:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.