How to Variable Width in ng-style

Asked 1 years ago, Updated 1 years ago, 52 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.