我有DisplayAlert范围,我想放在我的selectAttraction范围内。我希望窗口警报提示以及单击提交按钮时显示所选输入。
angular
.module('app')
.controller('AllAttractionController', ['$scope', 'attraction','$window', function ($scope, attraction, $window) {
$scope.attractions = attraction.find();
$scope.imgpath=function(imgName){
return "../img/"+ imgName;
};
$scope.selectAttraction = function()
{
var selected = '';
for (var i = 0; i < attractions.length; i++) {
if(attraction[i].selected){
selected += attraction[i].attractionName;
}
}
};
$scope.DisplayAlert = function(message){
$window.alert(message);
};
}]);
<input type="submit" value="Submit" ng-click="selectAttraction('Test')" ui-sref="view-attraction">