2017-02-22 74 views
-1

在頭版有兩種選擇:獲取數據,形成

1,創建新

2.edit

1.it去的index.html

2.它應該去數據索引html(數據應該從數據庫加載)

//從數據庫中獲取數據

$scope.getItem = function(id) { 
       var auth = btoa("root:root"); 
       $scope.form["@class"] = "ProjectDetails"; 
       $http.defaults.headers.common.Authorization = 'Basic ' + auth; 
       $http.get("http://azuspeedcp01:2480/document/InternalRPA/"+id+"/*:-1", { 


        }) 
        .then(function(response) { 

        console.log(response); 
        $scope.form=response.data; 

        });  

    } 

這裏我從數據庫取回數據fine.its response.data 再次分配給$ scope.form這是我從形式傳遞給提交數據的對象。

//index.html(partial)

<input type="text" id="clientName" ng-model="form.ClientName"> 
<input type="text" id="initiate" ng-model="form.City"> 
<select id="Geo" ng-model="form.Geo"> 
    <option value="North America">North America</option> 
</select> 

如何路由與數據的index.html。我沒有想法,請幫助我。

+0

'response.data'的內容是什麼? – sisyphus

+0

顯示完整的代碼 –

+0

@sisyphus response.data意味着它從數據庫提供json和整個數據,我需要以表格 – dhanu

回答

0
  • 它去的index.html

  • 應該去指數HTML數據(數據應該從數據庫負載)

所以你想要始終保持在同一屏幕上,那麼爲什麼你想在同一屏幕上重定向(刷新)? 你可以在任何地方使用相同的範圍對象在同一屏幕(的index.html)


  • 應該去指數HTML數據(數據應該從數據庫負載)

如果你想重定向數據。然後只需使用location.$path("routename")重定向屏幕,並使用$localStorage

+0

我沒有得到它你說的.same形式,但在第二個選項我需要數據在db – dhanu

0

我發現我可以用角服務路由從一個服務another.Thanks答案維持值都幫我

app.service('srvShareData', function($window) { 
    var KEY = 'App.SelectedValue'; 

    var addData = function(newObj) { 
     alert("2"+newObj); 



    $window.sessionStorage.setItem(KEY,JSON.stringify(newObj)); 

    }; 

    var getData = function(){ 
     var mydata = $window.sessionStorage.getItem(KEY); 


    return mydata; 
    }; 
    return { 

     addData: addData, 
     getData: getData 
    }; 
})