大佬教程收集整理的这篇文章主要介绍了angularjs – 无法直接从浏览器访问Angular Component,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试直接访问URL(或刷新页面)时会出现问题 – 页面根本无法加载.控制台中没有出现错误 – 没有任何反应.
我的配置如下:
根组件:
.component('webGuiComponent',{ template: '<ng-outlet></ng-outlet>',$routeConfig: [ { path: '/welcome/...',name: 'Welcome',component: 'welcomeComponent',useAsDefault: true } ] }) .value('$routerRootComponent','webGuiComponent');
欢迎组件:
.component('welcomeComponent',{ template: '<header></header><ng-outlet></ng-outlet>',$routeConfig: [ { path: '/',name: 'Index',component: 'indexComponent',useAsDefault: true },{ path: '/newUser',name: 'NewUser',component: 'newUser' } ] }) .component('indexComponent',{ templateUrl: '/app/components/welcome/index.html' });
新用户组件:
.component('newUser',{ controller: 'userController',templateUrl: '/app/components/user/new.html' })
导航链接使用标准ng-links:
<a class="navbar-brand" ng-link="['/Welcome/Index']">Web GUI</a> <a class="navbar-brand" ng-link="['/Welcome/NewUser']">Sign Up</a>
有没有人知道为什么导航通过ng-link完成,但直接访问URL时没有?
以上是大佬教程为你收集整理的angularjs – 无法直接从浏览器访问Angular Component全部内容,希望文章能够帮你解决angularjs – 无法直接从浏览器访问Angular Component所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。