Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用ionic ng模型返回TypeError:无法读取属性';用户名';未定义的_Angularjs_Ionic Framework - Fatal编程技术网

Angularjs 使用ionic ng模型返回TypeError:无法读取属性';用户名';未定义的

Angularjs 使用ionic ng模型返回TypeError:无法读取属性';用户名';未定义的,angularjs,ionic-framework,Angularjs,Ionic Framework,TypeError:无法读取未定义的属性“username” 在Scope.$Scope.login传递参数时出错。请将其更改为 ng-click=login(data.username,data.password) 然后,在控制器中 $scope.login = function(username,password){ $scope.username = username; $scope.password = password; ........... } 在控制器的第一行创建

TypeError:无法读取未定义的属性“username”
在Scope.$Scope.login传递参数时出错。请将其更改为

ng-click=login(data.username,data.password)
然后,在控制器中

$scope.login = function(username,password){
   $scope.username = username;
   $scope.password = password;
...........
}

在控制器的第一行创建一个示例plnkrWrite
$scope.data={};
,然后重试。我是这样尝试的:$scope.data={};alert($scope.data.username);但仍然不起作用:[alert:undefined]fix:$scope.data={};alert(data.username);我非常相信它确实有效。我想了很多!