【发布时间】:2018-02-27 02:18:19
【问题描述】:
我已经用 express 设置了 MLABS,它可以很好地连接到数据库,然后我有一个 angular2 服务,当单击按钮为 MLAB 执行 GET 时,它可以联系 expressjs。这是我感到困惑的部分,当单击按钮时,希望 angular2 移动到新组件(页面)以显示搜索结果并获取 GET 的结果并在那里显示它们。按钮和 GET 由充当导航栏的 app.component 完成,因此我在应用程序中的位置无关紧要,我应该能够在顶部的搜索栏中输入字符串,它会将我带到一个页面单击导航栏上的搜索图标后的结果。
我在应用顶部的搜索栏:
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
路由模型:
const appRoutes: Routes = [
{
path: '',
component: WelcomeComponent
},
{
path:'home',
component: HomeComponent
},
{
path:'profile',
component: ProfileComponent
},
{
path: 'request',
component: RequestComponent
},
{
path: 'mapsmenu',
component: MapsMenuComponent
},
{
path: 'activity',
component: TransactionsComponent
},
{
path: 'poststatus',
component: PostStatusComponent
},
{
path: 'map',
component: CryptoMapComponent
},
{
path: 'trading',
component: tradingComponent
},
{
path: 'friends',
component: FriendsComponent
},
{
path: 'linkwallet',
component: WalletComponent
},
{
path: 'newwallet',
component: NewWalletComponent
},
{
path: 'settings',
component: SettingsComponent
},
{
path: 'register',
component: RegisterComponent
},
{
path: 'FAQ',
component: FAQComponent
}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
【问题讨论】:
-
你能发布你的路由模块吗?
-
我在那里添加的
标签: angular mean-stack mlab