Javascript 角度ng只读和位置搜索
你好,我有一个html文件。如果URL中有参数,我将尝试将输入设置为只读。尝试过这样的事情,但没有成功Javascript 角度ng只读和位置搜索,javascript,angularjs,Javascript,Angularjs,你好,我有一个html文件。如果URL中有参数,我将尝试将输入设置为只读。尝试过这样的事情,但没有成功 <input type="text" name="firstName" ng-readonly="$location.search().memRen" /> 也许是ngIf的解决方案?我不确定自己是不是刚接触过angular服务不符合$scope对象上的定义。您必须在作用域上分配服务(不推荐!),或者添加变量: function myController($scope, $
<input type="text" name="firstName" ng-readonly="$location.search().memRen" />
也许是ngIf的解决方案?我不确定自己是不是刚接触过angular服务不符合
$scope
对象上的定义。您必须在作用域上分配服务(不推荐!),或者添加变量:
function myController($scope, $location) {
$scope.memRen = $location.search().memRen;
}
在您的html中:
<input type="text" name="firstName"
ng-readonly="memRen" />
$location
可能不是$scope
上的变量您是否设置了$locationProvider.html5Mode(true)?请被否决的选民解释一下为什么这个答案被否决?因为他是feg的选民,请支持我,我是新来的,我会接受你的答案