Angularjs传递值 [英] Angularjs passing values

查看:115
本文介绍了Angularjs传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有input元素像这样

I have input element like this

 <input type="text" name="a_id" ng-model="cont.a_id"  ui-event="{blur: 'blurCallback(a_id)'}"/>

在我的控制器我有

in my controller I have

$scope.blurCallback = function (a_id) {
        $scope.aId = a_id;
        alert($scope.aId);
    }

当我运行此警报给了我未定义
请让我知道我做错了,它不会通过输入值时

When I run this alert gives me "undefined" Please let me know what I am doing wrong that it wont pass the value when entered

推荐答案

A_ID'是不确定的。你应该通过'cont.a_id作为参数传递给函数。检查这个普拉克 http://plnkr.co/edit/E6AJ4NFDJT3CtJXAzom1?p=$p$ PVIEW

'a_id' is undefined. you should pass 'cont.a_id' as the argument to the function. check this plunk http://plnkr.co/edit/E6AJ4NFDJT3CtJXAzom1?p=preview

这篇关于Angularjs传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆