您的位置:首页 > Web前端 > AngularJS

angular简单调用model

2015-03-18 14:02 127 查看
angular.module('hairApp', []).config(['$interpolateProvider',
function($interpolateProvider) {
$interpolateProvider.startSymbol('{[{');
$interpolateProvider.endSymbol('}]}');
}])

angular.module('hairApp').controller('ApiActivityController',
function($scope,
$http){
var url = window.location.href;
//得到当前url链接地址
var pidarray = url.split('/');
//将url链接地址分改成数组

$scope.aid = Number(pidarray[pidarray.length-1]);
//取出最后为数组的部分

$scope.apply = function (target) {
$http({
method:'post',
data:{
aid:$scope.aid
},
url:'/api/activity/applyunderactivity'
}).error(function(error){
alert('服务器开小差了,请刷新页面!');
}).success(function(data,
status){
if(data == 'nosign'){
alert('请登录后发表回复!');
} else if (data ==
'success') {
//$scope.getReplyList();
alert('成功');
location.reload();

} else {
alert('报名失败,请再试一次!');
}
})
};

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: