http.get我無法弄清楚如何重寫這個AngularJS $ http.get到Angular2:Angular2從外部API
$scope.toggle = function() {
$http.get('http://example.com?operation=getEmployeeData', {
params: {
data: JSON.stringify({
params: {
firstName : 'John',
lastName : 'Doe',
empType : 'Administrative',
orgUnit : 'Management',
lang : 'Eng'
}
})
}
}).then(function(data) { $scope.staff = data }
該如何與參數的URL看起來像:
http://example.com?operation=getEmployeeData&data= {「params」:{「firstName」:「John」,「lastName」:「Doe」,「empType」:「Administrative」,「orgUnit」:「Management」,「lang」:「Eng」}}
我如何在Angular2中做到這一點? 謝謝!