Files
freeCodeCamp/guide/chinese/miscellaneous/create-a-new-route-in-angular/index.md
2018-10-16 21:32:40 +05:30

12 lines
786 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Create a New Route in Angular
localeTitle: 在Angular中创建一个新路径
---
> > yo angular-fullstack路由新页面
在命令行中输入上述内容将为您的应用生成新页面**/**路线!它会自动生成**/ client / app / newpage**文件夹中的所有必要文件,例如**/ client / app / main**文件夹,包含**newpage.controller.js** **newpage.controller.spec.js** **newpage.js**和**newpage。 HTML** 。这些都非常像**主/**路线中的那些。如果您正在访问新页面控制器中的数据库则需要将new _http_添加到**newpage.controller.js**中的依赖项列表,方法与**main.controller.js中**包含的**相同**
```
angular.module('myApp')
.controller('MainCtrl', function ($scope, $http) { ...
```