我的路线定义如下:
我的app.component.html有两个出口:
const routes: Routes = [
{ path: 'contents/:id', component: ContentComponent, children: [
{ path: 'edit', component: ContentFormComponent, outlet: 'modal' }
]},
];
我的路线:
<a [routerLink]="[ {outlets: { modal: 'edit' } } ]" >edit</a>
路由(示例)/ contents / 324231使用ContentComponent加载正常。 我需要做的是route / contents / 324231 / edit将ContentFormComponent加载到'modal'出口内。
我尝试按照示例建立链接:
"""
BEFORE RUNNING:
---------------
1. If not already done, enable the Google Sheets API
and check the quota for your project at
https://console.developers.google.com/apis/api/sheets
2. Install the Python client library for Google APIs by running
`pip install --upgrade google-api-python-client`
"""
from pprint import pprint
from googleapiclient import discovery
# TODO: Change placeholder below to generate authentication credentials. See
# https://developers.google.com/sheets/quickstart/python#step_3_set_up_the_sample
#
# Authorize using one of the following scopes:
# 'https://www.googleapis.com/auth/drive'
# 'https://www.googleapis.com/auth/drive.file'
# 'https://www.googleapis.com/auth/spreadsheets'
credentials = None
service = discovery.build('sheets', 'v4', credentials=credentials)
# The ID of the spreadsheet to update.
spreadsheet_id = 'my-spreadsheet-id' # TODO: Update placeholder value.
# The A1 notation of a range to search for a logical table of data.
# Values will be appended after the last row of the table.
range_ = 'my-range' # TODO: Update placeholder value.
# How the input data should be interpreted.
value_input_option = '' # TODO: Update placeholder value.
# How the input data should be inserted.
insert_data_option = '' # TODO: Update placeholder value.
value_range_body = {
# TODO: Add desired entries to the request body.
}
request = service.spreadsheets().values().append(spreadsheetId=spreadsheet_id, range=range_, valueInputOption=value_input_option, insertDataOption=insert_data_option, body=value_range_body)
response = request.execute()
# TODO: Change code below to process the `response` dict:
pprint(response)
它给出了href:/ contents / 1 /(模态:编辑)
当我点击链接时,url会更改为此但是未加载组件(不会调用构造函数或ngOnInit方法)。
有什么想法吗?