[英]Passing objects from a view to controller
I am passing few parameters from a view to a directive. 我正在将少量参数从视图传递到指令。 Currently, I am passing that as
目前,我通过的是
<text-logo class="cmp_logo default-logo-style">{ 'logo' => "{{row.logo}}", 'subtext' => "{{row.name}}", 'height' => "75", 'width' => "75", 'cx' => "37", 'cy' => "37", 'r' => "35", 'font_size'=> "25", 'y' => "47", 'x' => "21" }</text-logo>
I want to pass the parameters as an object, like 我想将参数作为对象传递,例如
'style': {
'height': 75,
'width': 75,
'cx': 37
}
How can I implement that in my view? 我认为该如何实施? How can I pass it to my controller?
如何将其传递给控制器?
I think that you only need ng-model="obj"
and you can access it in your controller by $scope. 我认为您只需要
ng-model="obj"
即可通过$ scope在控制器中访问它。 ie $scope.obj
即
$scope.obj
<text-logo ng-model="obj" class="cmp_logo default-logo-style">{ 'logo' => "{{row.logo}}", 'subtext' => "{{row.name}}", 'height' => "75", 'width' => "75", 'cx' => "37", 'cy' => "37", 'r' => "35", 'font_size'=> "25", 'y' => "47", 'x' => "21" }</text-logo>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.