【发布时间】:2017-07-12 07:38:22
【问题描述】:
我使用带角度的 php,我想从 php 表达式中设置 ng 模型中的值,然后从控制器中读取 ng-model 值,但这些值为空:/
<input ng-model="id" ng-init="id= '<?php echo $userID ?>'">
控制器:
$scope.id = "";
$scope.getId = function() {
console.log($scope.id); // ==> id value is "", but in the html is 455
}
【问题讨论】:
-
PHP 输出的最终源代码是什么?
-
您的输入是文本、复选框等吗?
标签: javascript php angularjs function