小编Joh*_*man的帖子

如何作为模块的子项路由到模块 - Angular 2 RC 5

我正在将正在处理的应用程序升级到最新的Angular 2候选版本.作为这项工作的一部分,我试图使用NgModule规范并将我的应用程序的所有部分迁移到模块.在大多数情况下,除了路由问题之外,这已经非常顺利.

"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-rc.1",
Run Code Online (Sandbox Code Playgroud)

我的应用程序是作为模块的组合构建的,其中几个模块粘合在一起作为父模块的子项.例如,我有一个管理模块,它包含通知模块,用户模块和电话模块(例如).这些模块的路径应该像......

/admin/notifications/my-notifications
/admin/users/new-user
/admin/telephony/whatever
Run Code Online (Sandbox Code Playgroud)

在路由器的早期版本中,使用"children"很容易实现

export const AdminRoutes: RouterConfig = [
   {
      path: "Admin",
      component: AdminComponent,
      Children: [
         ...UserRoutes,
         ...TelephonyRoutes,
         ...NotificationRoutes
      ]
   }
]
Run Code Online (Sandbox Code Playgroud)

在另一个文件中,作为子模块的一部分,我也定义了各个模块路由

export const UserRoutes: RouterConfig = [
    {
       path: "users",
       component: userComponent,
       children: [
           {path: "new-user", component: newUserComponent}
       ]
    }

]
Run Code Online (Sandbox Code Playgroud)

这一切都很有效.在升级到模块的过程中,我将所有内容都移动到了各自的路由文件中,所以现在这两个看起来更像是这样

const AdminRoutes: Routes = [
    {path: "admin", component: AdminComponent}
] 

export const adminRouting = RouterModule.forChild(AdminRoutes)
Run Code Online (Sandbox Code Playgroud)

和 …

angular2-routing angular2-router3 angular2-modules angular

62
推荐指数
3
解决办法
6万
查看次数

从 Android WebView 获取 HTTPOnly Cookie

我正在 Android webview 上设置自定义下载侦听器以拦截文件下载并将其路由到下载管理器。作为其中的一部分,我使用 CookieManager.getInstance().getCookie(url) 方法。这会返回一些 cookie,但不是全部。具体来说,似乎没有返回 HTTPOnly(和/或安全)cookie。我的 URL 是https://some.url所以我希望能够看到它们。

关于如何从 WebView 中取回这些 cookie 以便我可以使用它们或以其他方式处理我的文件下载的任何建议?

android android-webview

5
推荐指数
1
解决办法
685
查看次数