Total Pageviews


How do I do redirect in AngularJS

I would like to do window.location (JavaScript way) to redirect page.
How do I do in AngularJS?

You can use $window.location.href=[your link]

According to the system analysis specification, system should redirect to specific page based on the option which chose by user.

1:  <div class="form-group col-sm-5">  
2:            <label class="control-label">選擇查詢報表 :</label>  
3:            <select class="form-control" data-ng-change="update()"  
4:                id="reportName" name="reportName"   
5:                data-ng-model="model.reportName" >  
6:              <option value="" >請選擇</option>  
7:              <option value="ETS401R">收支狀況日報表 (總表)</option>  
8:              <option value="ETS402R">收支狀況日報表 (支出明細表)</option>  
9:              <option value="ETS403R">收支狀況日報表 (支入明細表)</option>  
10:              <option value="ETS407R">年度國庫現金餘額表</option>  
11:            </select>  
12:           </div>  

We can define $window.location.href in js file.
1:  $scope.update = function(){  
2:        var reportName = $scope.model.reportName;  
3:        $window.location.href = '/nss/'+reportName+'/';  
4:      };  

No comments: