在我的HTML中
<input type="text" ng-model="data.price" placeholder="Position" required/>
<button type="submit" ng-click="validate(data)">Save</button>
在我的controllers.js中:
$scope.validate = function(data){
$http.post(
'http://mysitename.com/folder/controller/method',
{
price: data.price
}
)
.success(function(res){
console.log(res);
})
.error(function(res){
console.log("Error: " + res);
});
}
在我的Controller.php中:
public function method() {
if($postdata = file_get_contents("php://input")) {
$this->form_validation->set_rules(??????, 'Price', 'required|is_money|trim');
if ($this->form_validation->run() == FALSE)
{
echo json_encode(validation_errors());
} else {
echo json_encode("working");
}
}
}
我应该在$this->form_validation->set_rules(??????, ' Price', 'required|is_money|trim');
中添加什么?
非常感谢任何帮助。谢谢:))