你好我是javascript和angularjs的新手,我已经在我的comtroller中打开了一个网站的功能,我在按钮的"onclick"上调用该功能",我得到了ReferenceError:当我尝试时,openWebsite没有被定义要做到这一点,我的代码如下,请帮我解决这个问题,提前谢谢.
调节器
app.controller('listingdetailController', function ($http, $scope, $compile, $filter, $sce) {
var Catid = '1';
var SearchTxt = 'cay';
var url = encodeURI("http://www.yahoo.com");
$http({
method: 'POST',
url: API_HOST+'/webservice/listingdetail',
headers:
{
'Content-Type': 'application/x-www-form-urlencoded',
'caymanauth': caymanauth
},
data: "&Catid=" + Catid + "&SearchTxt=" + SearchTxt,
contentType: 'application/x-www-form-urlencoded'
}).success(function (data)
{
var i;
var Content = ' ';
for (i = 0; i<data['Details'].length; i++)
{
if (Content === ' ')
{
Content =
'<div class="app-page-photo">'+
'<div class="app-hero">'+
'<ul class="image ng-scope" …Run Code Online (Sandbox Code Playgroud) 我有四个按钮和四个按钮div.现在,我想div一次只显示一个.这意味着,如果我单击第一个按钮,则只div应显示第一个按钮,并且应隐藏其他按钮.
我搜索了很多,没有运气.请帮我.我试过要表现如下:
HTML
<button ng-click="showAbout();">About Page</button>
<button ng-click="showhelp();">Help page</button>
<button ng-click="showinfo();">Info Page</button>
<button ng-click="showref();">Refrence page</button>
<div class="form-group" ng-show="showabout">
<p>About page</p>
</div>
<div class="form-group" ng-show="showhelp" >
<p>Help page</p>
</div>
<div class="form-group" ng-show="showinfo" >
<p>Info</p>
</div>
<div class="form-group" ng-show="showref" >
<p>Refrence</p>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
$scope.showabout = true;
$scope.showAbout = function () {
$scope.showhelp = false;
$scope.showinfo = false;
$scope.showref = false;
};
$scope.showhelp = true;
$scope.showhelp = function () {
$scope.showabout = false;
$scope.showinfo = false;
$scope.showref …Run Code Online (Sandbox Code Playgroud)