Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
d97c8038
Commit
d97c8038
authored
7 years ago
by
i317280
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into bootstrap4
parents
529d41f9
3e0fcb24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
app.component.ts
src/app/app.component.ts
+2
-2
app.service.ts
src/app/app.service.ts
+29
-4
No files found.
src/app/app.component.ts
View file @
d97c8038
...
...
@@ -2,12 +2,12 @@
* Created by liuzheng on 2017/8/31.
*/
import
{
Component
}
from
'@angular/core'
;
import
{
AppService
}
from
'./app.service'
;
import
{
AppService
,
HttpService
}
from
'./app.service'
;
@
Component
({
selector
:
'app-root'
,
templateUrl
:
'./app.component.html'
,
providers
:
[
AppService
],
providers
:
[
AppService
,
HttpService
],
// directives: [LeftbarComponent, TermComponent]
})
...
...
This diff is collapsed.
Click to expand it.
src/app/app.service.ts
View file @
d97c8038
...
...
@@ -105,48 +105,73 @@ export let Browser: {
vendor
:
navigator
.
vendor
,
};
@
Injectable
()
export
class
HttpService
{
headers
=
new
Headers
();
constructor
(
private
_http
:
Http
)
{
}
request
(
url
:
string
|
Request
,
options
?:
RequestOptionsArgs
)
{
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
request
(
url
,
options
)
}
// request(url: string | Request, options?: RequestOptionsArgs) {
// if (options == null) {
// options = {};
// }
// options.headers = this.headers;
// return this._http.request(url, options)
// }
get
(
url
:
string
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
get
(
url
,
options
)
}
post
(
url
:
string
,
body
:
any
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
post
(
url
,
body
,
options
)
}
put
(
url
:
string
,
body
:
any
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
put
(
url
,
body
,
options
)
}
delete
(
url
:
string
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
delete
(
url
,
options
)
}
patch
(
url
:
string
,
body
:
any
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
patch
(
url
,
body
,
options
)
}
head
(
url
:
string
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
head
(
url
,
options
)
}
options
(
url
:
string
,
options
?:
RequestOptionsArgs
)
{
if
(
options
==
null
)
{
options
=
{};
}
options
.
headers
=
this
.
headers
;
return
this
.
_http
.
options
(
url
,
options
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment