[英]AngularJS Passing data from view to controller using Laravel PHP call
I want to send some data to the simplecontroller, this data is called from the server by a Laravel or a PHP call. 我想将一些数据发送到simplecontroller,该数据是通过Laravel或PHP调用从服务器调用的。 I want to pass it easily like this ng.user.name directive is doing.
我想像ng.user.name指令那样轻松地传递它。
<div ng-controller="simplecontroller" id="simplecontroller">
<a href="#" "ng-name={{$company->name}}" "ng-id={{$company->id}}">{{$company->name}}</a>
My controller will use the name and id 我的控制器将使用名称和ID
app.controller('simplecontroller', function($scope) {
$scope.user = {
name = ng-name // or I could call {{$company->name}} here?
id = ng-id
};
Any way to achieve this functionality? 有什么方法可以实现此功能? Sorry, but I am SUPER NEW to Angular JS.
抱歉,但是我对Angular JS超级熟悉。 Please point me to the correct direction.
请指出正确的方向。
A lot of confusion in your code. 您的代码中有很多混乱。 You need to learn angularjs better...
您需要更好地学习angularjs ...
<div ng-controller="simplecontroller" id="simplecontroller">
<a href="#">{{company.name}}</a>
</div>
app.controller('simplecontroller', function($scope) {
$scope.company = {
"name":"Comapny Name", "id":"1"
};
});
This might help - https://www.tutorialspoint.com/angularjs/index.htm 这可能会有所帮助-https://www.tutorialspoint.com/angularjs/index.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.