我是Bootstrap
和AngularJS
的新用户,尝试提供权限取决于我尝试在表格中隐藏行(<td>
)的用户凭据。
abc.html
<td><span type="submit" data-ng-hide="edit" data-ng-click="edit = true" class="glyphicon glyphicon-edit" disabled="disabled"></span>
<span type="submit" data-ng-show="edit" data-ng-click="edit = false; save()" class="glyphicon glyphicon-save"></span>
<span type="submit" data-ng-show="edit" data-ng-click="edit = false; cancel()" class="glyphicon glyphicon-remove"></span></td>
我不确定工厂控制器中的js可以请任何人帮助我。
答案 0 :(得分:1)
将tr
的属性设置为ng-show=isVisible
,并在控制器中根据授权结果将其值设置为true
或false
。
答案 1 :(得分:1)
你的HTML会像这样
$scope.users = [{'name': 'John', 'isAuthorized': true},
{'name': 'Doe', 'isAuthorized': false}];
在您的控制器中,Idk如何获取用户详细信息(来自API的概率),但之后您会得到类似的内容
var x="10";
function f() {
var x="4"; // This is a local variable and not a property of f
alert(this.x); // "this" represent the global scope because you do not a new instance of f with the keyword "new" like this new f()
function g() {alert(x);} // The x variable reference the parent scope which is f
g();
}
f();