當前,我在我的網頁上使用了laravel和AngularJS。並且我想執行一個可以在點擊按鈕時顯示和隱藏表單的函數。在我編寫代碼之後,表單已成功顯示,但無法隱藏。單擊按鈕時執行一個函數
我寫master.blade.php頁面功能代碼:
var masterCtrl = angular.module('olshopApp', ['ngRoute']);
masterCtrl.controller('createController', function($scope){
$scope.isVisible = 'true';
$scope.ShowHide = function(){
$scope.IsVisible = !$scope.IsVisible;
};
});
這些代碼product.blade.php頁面上
<div class="form-actions" ng-controller="createController">
<button class="btn btn-primary icon-pencil bigger-110" type="button" ng-click="ShowHide()">
Add New
</button>
</div>
<div create-product ng-hide="isVisible"></div>