docs(aio): cleanup aalert, callout, subsection use and author style (#24986)

PR Close #24986
This commit is contained in:
Stefanie Fluin 2018-07-19 15:00:08 -07:00 committed by Victor Berchet
parent d6016f1d1d
commit d523630ea2
55 changed files with 345 additions and 306 deletions

View File

@ -22,7 +22,7 @@ code uses [AnimationBuilder](/api/animations/AnimationBuilder). If your code doe
uncomment the `web-animations-js` polyfill from the `polyfills.ts` file generated by Angular CLI.
</div>
<div class="l-sub-section">
<div class="alert is-helpful">
The examples in this page are available as a <live-example></live-example>.
@ -183,7 +183,7 @@ transition definitions, and not in a separate `state(void)` definition. Thus, th
are different on enter and leave: the element enters from the left
and leaves to the right.
<div class="l-sub-section">
<div class="alert is-helpful">
These two common animations have their own aliases:

View File

@ -4,7 +4,7 @@ The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML and TypeScri
This guide explains how to build with the AOT compiler using different compiler options and how to write Angular metadata that AOT can compile.
<div class="l-sub-section">
<div class="alert is-helpful>
<a href="https://www.youtube.com/watch?v=kW9cJsvcsGo">Watch compiler author Tobias Bosch explain the Angular Compiler</a> at AngularConnect 2016.
@ -39,7 +39,7 @@ For AOT compilation, append the `--aot` flags to the _build-only_ or the _build-
ng serve --aot
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `--prod` meta-flag compiles with AOT by default.
@ -297,7 +297,7 @@ At the same time, the AOT **_collector_** analyzes the metadata recorded in the
You can think of `.metadata.json` as a diagram of the overall structure of a decorator's metadata, represented as an [abstract syntax tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree).
<div class="l-sub-section">
<div class="alert is-helpful">
Angular's [schema.ts](https://github.com/angular/angular/blob/master/packages/compiler-cli/src/metadata/schema.ts)
describes the JSON format as a collection of TypeScript interfaces.
@ -333,7 +333,7 @@ Parentheses | `(a + b)`
If an expression uses unsupported syntax, the _collector_ writes an error node to the `.metadata.json` file. The compiler later reports the error if it needs that
piece of metadata to generate the application code.
<div class="l-sub-section">
<div class="alert is-helpful">
If you want `ngc` to report syntax errors immediately rather than produce a `.metadata.json` file with errors, set the `strictMetadataEmit` option in `tsconfig`.

View File

@ -26,7 +26,7 @@ Here's a simple root NgModule definition:
<code-example path="architecture/src/app/mini-app.ts" region="module" title="src/app/app.module.ts" linenums="false"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `export` of `AppComponent` is just to show how to export; it isn't actually necessary in this example. A root NgModule has no reason to _export_ anything because other modules don't need to _import_ the root NgModule.
@ -56,7 +56,7 @@ A component and its template together define a _view_. A component can contain a
When you create a component, it is associated directly with a single view, called the _host view_. The host view can be the root of a view hierarchy, which can contain _embedded views_, which are in turn the host views of other components. Those components can be in the same NgModule, or can be imported from other NgModules. Views in the tree can be nested to any depth.
<div class="l-sub-section">
<div class="alert is-helpful">
The hierarchical structure of views is a key factor in the way Angular detects and responds to changes in the DOM and app data.
</div>
@ -72,7 +72,7 @@ Other JavaScript modules use *import statements* to access public objects from o
<code-example path="architecture/src/app/app.module.ts" region="export" linenums="false"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
<a href="http://exploringjs.com/es6/ch_modules.html">Learn more about the JavaScript module system on the web.</a>
</div>
@ -99,7 +99,7 @@ In the example of the simple root module above, the application module needs mat
In this way you're using both the Angular and JavaScript module systems _together_. Although it's easy to confuse the two systems, which share the common vocabulary of "imports" and "exports", you will become familiar with the different contexts in which they are used.
<div class="l-sub-section">
<div class="alert is-helpful">
Learn more from the [NgModules](guide/ngmodules) page.

View File

@ -27,7 +27,7 @@ Like JavaScript modules, NgModules can import functionality from other NgModules
Organizing your code into distinct functional modules helps in managing development of complex applications, and in designing for reusability. In addition, this technique lets you take advantage of _lazy-loading_&mdash;that is, loading modules on demand&mdash;in order to minimize the amount of code that needs to be loaded at startup.
<div class="l-sub-section">
<div class="alert is-helpful">
For a more detailed discussion, see [Introduction to modules](guide/architecture-modules).
@ -39,7 +39,7 @@ Every Angular application has at least one component, the *root component* that
The `@Component` decorator identifies the class immediately below it as a component, and provides the template and related component-specific metadata.
<div class="l-sub-section">
<div class="alert is-helpful">
Decorators are functions that modify JavaScript classes. Angular defines a number of such decorators that attach specific kinds of metadata to classes, so that it knows what those classes mean and how they should work.
@ -59,7 +59,7 @@ Before a view is displayed, Angular evaluates the directives and resolves the bi
Your templates can also use *pipes* to improve the user experience by transforming values for display. Use pipes to display, for example, dates and currency values in a way appropriate to the user's locale. Angular provides predefined pipes for common transformations, and you can also define your own.
<div class="l-sub-section">
<div class="alert is-helpful">
For a more detailed discussion of these concepts, see [Introduction to components](guide/architecture-components).
@ -74,7 +74,7 @@ For data or logic that is not associated with a specific view, and that you want
*Dependency injection* (or DI) lets you keep your component classes lean and efficient. They don't fetch data from the server, validate user input, or log directly to the console; they delegate such tasks to services.
<div class="l-sub-section">
<div class="alert is-helpful">
For a more detailed discusssion, see [Introduction to services and DI](guide/architecture-services).
@ -96,7 +96,7 @@ The router interprets a link URL according to your app's view navigation rules a
To define navigation rules, you associate *navigation paths* with your components. A path uses a URL-like syntax that integrates your program data, in much the same way that template syntax integrates your views with your program data. You can then apply program logic to choose which views to show or to hide, in response to user input and your own access rules.
<div class="l-sub-section">
<div class="alert is-helpful">
For a more detailed discussion, see [Routing and navigation](guide/router).
@ -128,7 +128,7 @@ Each of these subjects is introduced in more detail in the following pages.
* [Pipes](guide/architecture-components#pipes)
* [Services and dependency injection](guide/architecture-services)
<div class="l-sub-section">
<div class="alert is-helpful">
Note that the code referenced on these pages is available as a <live-example></live-example>.
</div>

View File

@ -51,7 +51,7 @@ ng generate directive highlight
The CLI creates `src/app/highlight.directive.ts`, a corresponding test file (`.../spec.ts`, and _declares_ the directive class in the root `AppModule`.
<div class="l-sub-section">
<div class="alert is-helpful">
_Directives_ must be declared in [Angular Modules](guide/ngmodules) in the same manner as _components_.
@ -71,7 +71,7 @@ Angular locates each element in the template that has an attribute named `appHig
The _attribute selector_ pattern explains the name of this kind of directive.
<div class="l-sub-section">
<div class="alert is-helpful">
#### Why not "highlight"?
@ -146,7 +146,7 @@ each adorned by the `HostListener` decorator.
The `@HostListener` decorator lets you subscribe to events of the DOM
element that hosts an attribute directive, the `<p>` in this case.
<div class="l-sub-section">
<div class="alert is-helpful">
Of course you could reach into the DOM with standard JavaScript and attach event listeners manually.
There are at least three problems with _that_ approach:

View File

@ -95,7 +95,7 @@ Angular supports most recent browsers. This includes the following specific vers
</table>
<div class="l-sub-section">
<div class="alert is-helpful">
Angular's continuous integration process runs unit tests of the framework on all of these browsers for every pull request,
using <a href="https://saucelabs.com/">SauceLabs</a> and
@ -154,7 +154,7 @@ add it yourself, following the same pattern:
1. install the npm package
1. `import` the file in `polyfills.ts`
<div class="l-sub-section">
<div class="alert is-helpful">
Non-CLI users should follow the instructions [below](#non-cli).
</div>

View File

@ -119,7 +119,7 @@ E2E tests of input property setter with empty and non-empty names:
Detect and act upon changes to input property values with the `ngOnChanges()` method of the `OnChanges` lifecycle hook interface.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -311,7 +311,7 @@ The following example illustrates this technique with the same
Neither its appearance nor its behavior will change.
The child [CountdownTimerComponent](guide/component-interaction#countdown-timer-example) is the same as well.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -400,7 +400,7 @@ Each `AstronautComponent` is a child of the `MissionControlComponent` and theref
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -187,7 +187,7 @@ They are _not inherited_ by any components nested within the template nor by any
</div>
<div class="l-sub-section">
<div class="alert is-helpful">
You can specify more than one styles file or even a combination of `styles` and `styleUrls`.

View File

@ -25,7 +25,7 @@ application and don't need to be listed in any module.
Service classes can act as their own providers which is why defining them in the `@Injectable` decorator
is all the registration you need.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -167,7 +167,7 @@ that is visible only to the component and its children, if any.
You could also provide the `HeroService` to a *different* component elsewhere in the application.
That would result in a *different* instance of the service, living in a *different* injector.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -433,7 +433,7 @@ It may already have that value in its internal container.
If it doesn't, it may be able to make one with the help of a ***provider***.
A *provider* is a recipe for delivering a service associated with a *token*.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -577,7 +577,7 @@ The second provider substitutes the `DateLoggerService` for the `LoggerService`.
The `LoggerService` is already registered at the `AppComponent` level.
When _this component_ requests the `LoggerService`, it receives the `DateLoggerService` instead.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -645,7 +645,7 @@ The `HeroOfTheMonthComponent` constructor's `logger` parameter is typed as `Mini
Behind the scenes, Angular actually sets the `logger` parameter to the full service registered under the `LoggingService` token which happens to be the `DateLoggerService` that was [provided above](guide/dependency-injection-in-action#useclass).
<div class="l-sub-section">
<div class="alert is-helpful">
@ -707,7 +707,7 @@ After some undisclosed work, the function returns the string of names
and Angular injects it into the `runnersUp` parameter of the `HeroOfTheMonthComponent`.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -769,7 +769,7 @@ A ***class-interface*** should define *only* the members that its consumers are
Such a narrowing interface helps decouple the concrete class from its consumers.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -866,7 +866,7 @@ and displays them in the order they arrive from the database.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -982,7 +982,7 @@ If you're lucky, they all implement the same base class
whose API your `NewsComponent` understands.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1165,7 +1165,7 @@ its class signature doesn't mention `Parent`:
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -81,7 +81,7 @@ now in the constructor.
The `Car` class no longer creates an `engine` or `tires`.
It just consumes them.
<div class="l-sub-section">
<div class="alert is-helpful">
This example leverages TypeScript's constructor syntax for declaring
parameters and properties simultaneously.
@ -101,7 +101,7 @@ conform to the general API requirements of an `engine` or `tires`.
Now, if someone extends the `Engine` class, that is not `Car`'s problem.
<div class="l-sub-section">
<div class="alert is-helpful">
The _consumer_ of `Car` has the problem. The consumer must update the car creation code to
something like this:

View File

@ -98,7 +98,7 @@ Without a provider, the injector would not know
that it is responsible for injecting the service
nor be able to create the service.
<div class="l-sub-section">
<div class="alert is-helpful">
You'll learn much more about _providers_ [below](#providers).
For now, it is sufficient to know that they configure where and how services are created.
@ -141,7 +141,7 @@ The second registers a value (`HERO_DI_CONFIG`) under the `APP_CONFIG` _injectio
With the above registrations, Angular can inject the `UserService` or the `HERO_DI_CONFIG` value
into any class that it creates.
<div class="l-sub-section">
<div class="alert is-helpful">
You'll learn about _injection tokens_ and _provider_ syntax [below](#providers).
</div>
@ -174,7 +174,7 @@ You're likely to inject the `UserService` in many places throughout the app
and will want to inject the same service instance every time.
Providing the `UserService` with an Angular module is a good choice if an `@Injectable` provider is not an option..
<div class="l-sub-section">
<div class="alert is-helpful">
To be precise, Angular module providers are registered with the root injector
_unless the module is_ [lazy loaded](guide/lazy-loading-ngmodules).
@ -199,7 +199,7 @@ and is never destroyed so the `HeroService` created for the `HeroComponent` also
If you want to restrict `HeroService` access to the `HeroComponent` and its nested `HeroListComponent`,
providing the `HeroService` in the `HeroComponent` may be a good choice.
<div class="l-sub-section">
<div class="alert is-helpful">
The scope and lifetime of component-provided services is a consequence of [the way Angular creates component instances](#component-child-injectors).
@ -375,7 +375,7 @@ and let the injector pass them along to the factory function:
<code-example path="dependency-injection/src/app/heroes/hero.service.provider.ts" region="provider" title="src/app/heroes/hero.service.provider.ts (excerpt)" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `useFactory` field tells Angular that the provider is a factory function
whose implementation is the `heroServiceFactory`.
@ -440,7 +440,7 @@ The service can be instantiated by configuring a factory function as shown below
<code-example path="dependency-injection/src/app/tree-shaking/service.0.ts" title="src/app/tree-shaking/service.0.ts" linenums="false"> </code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
To override tree-shakable providers, register the provider using the `providers: []` array syntax of any Angular decorator that supports it.
@ -532,7 +532,7 @@ under test:
<code-example path="dependency-injection/src/app/test.component.ts" region="spec" title="src/app/test.component.ts" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
Learn more in the [Testing](guide/testing) guide.
@ -636,7 +636,7 @@ But what should you use as the token?
You don't have a class to serve as a token.
There is no `AppConfig` class.
<div class="l-sub-section">
<div class="alert is-helpful">
### TypeScript interfaces aren't valid tokens
@ -742,7 +742,7 @@ You can call `get()` with a second parameter, which is the value to return if th
is not found. Angular can't find the service if it's not registered with this or any ancestor injector.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -776,7 +776,7 @@ If you define the component before the service,
you'll get a runtime null reference error.
<div class="l-sub-section">
<div class="alert is-helpful">
You actually can define the component first with the help of the `forwardRef()` method as explained
in this [blog post](http://blog.thoughtram.io/angular/2015/09/03/forward-references-in-angular-2.html).

View File

@ -187,7 +187,7 @@ For example, given the `<base href="/my/app/">`, the browser resolves a URL such
into a server request for `my/app/some/place/foo.jpg`.
During navigation, the Angular router uses the _base href_ as the base path to component, template, and module files.
<div class="l-sub-section">
<div class="alert is-helpful">
See also the [*APP_BASE_HREF*](api/common/APP_BASE_HREF "API: APP_BASE_HREF") alternative.
@ -215,7 +215,7 @@ The `ng build` command writes generated build artifacts to the output folder.
The `ng serve` command does not.
It serves build artifacts from memory instead for a faster development experience.
<div class="l-sub-section">
<div class="alert is-helpful">
The output folder is `dist/` by default.
To output to a different folder, change the `outputPath` in `angular.json`.

View File

@ -13,7 +13,7 @@ The final UI looks like this:
<img src="generated/images/guide/displaying-data/final.png" alt="Final UI">
</figure>
<div class="l-sub-section">
<div class="alert is-helpful">
@ -60,7 +60,7 @@ interpolation:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -79,7 +79,7 @@ inserts those values into the browser. Angular updates the display
when these properties change.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -213,7 +213,7 @@ to the item (the hero) in the current iteration. Angular uses that variable as t
context for the interpolation in the double curly braces.
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -47,7 +47,7 @@ The reader requests a page by its Page URL. The doc viewer fetches the correspon
Page URLs mirror the `content` file structure. The URL for the page of a guide is in the form `guide/{page-name}`. The page for _this_ "Authors Style Guide" is located at `content/guide/docs-style-guide.md` and its URL is `guide/docs-style-guide`.
<div class="l-sub-section">
<div class="alert is-helpful">
_Tutorial_ pages are exactly like guide pages. The only difference is that they reside in `content/tutorial` instead of `content/guide` and have URLs like `tutorial/{page-name}`.
@ -84,7 +84,7 @@ Standard markdown processors don't allow you to put markdown _within_ HTML tags.
</div>
```
<div class="l-sub-section">
<div class="alert is-helpful">
It is customary but not required to _precede_ the _closing HTML_ tag with a blank line as well.
@ -162,34 +162,6 @@ Try to minimize the heading depth, preferably only two. But more headings, such
Try to minimize ...
```
## Subsections
Subsections typically present extra detail and references to other pages.
Use subsections for commentary that _enriches_ the reader's understanding of the text that precedes it.
A subsection _must not_ contain anything _essential_ to that understanding. Don't put a critical instruction or a tutorial step in a subsection.
A subsection is content within a `<div>` that has the `l-sub-section` CSS class. You should write the subsection content in markdown.
Here is an example of a subsection `<div>` surrounding the subsection content written in markdown.
<div class="l-sub-section">
You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples").
</div>
```html
<div class="l-sub-section">
You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples").
</div>
```
Note that at least one blank line must follow the opening `<div>`. A blank line before the closing `</div>` is customary but not required.
## Table of contents
Most pages display a table of contents (TOC). The TOC appears in the right panel when the viewport is wide. When narrow, the TOC appears in an expandable/collapsible region near the top of the page.
@ -322,7 +294,7 @@ The author must also write end-to-end tests for the sample.
Code samples are located in sub-folders of the `content/examples` directory of the `angular/angular` repository. An example folder name should be the same as the guide page it supports.
<div class="l-sub-section">
<div class="alert is-helpful">
A guide page might not have its own sample code. It might refer instead to a sample belonging to another page.
@ -355,7 +327,7 @@ In this example, that path is `docs-style-guide/src/app/app.module.ts`.
You added a header to tell the reader where to find the file by setting the `title` attribute.
Following convention, you set the `title` attribute to the file's location within the sample's root folder.
<div class="l-sub-section">
<div class="alert is-helpful">
Unless otherwise noted, all code snippets in this page are derived from sample source code
located in the `content/examples/docs-style-guide` directory.
@ -523,7 +495,7 @@ The `linenums` attribute in the second pane restores line numbering for _itself
You must add special code snippet markup to sample source code files before they can be displayed by `<code-example>` and `<code-tabs>` components.
<div class="l-sub-section">
<div class="alert is-helpful">
The sample source code for this page, located in `context/examples/docs-style-guide`, contains examples of every code snippet markup described in this section.
@ -570,7 +542,7 @@ The `<code-example>` and `<code-tabs>` components won't display a source code fi
The _#docregion_ comment begins a code snippet region.
Every line of code _after_ that comment belongs in the region _until_ the code fragment processor encounters the end of the file or a closing _#enddocregion_.
<div class="l-sub-section">
<div class="alert is-helpful">
The `src/main.ts` is a simple example of a file with a single _#docregion_ at the top of the file.
@ -613,7 +585,7 @@ You can nest _#docregions_ within _#docregions_
... yet more code ...
/// #enddocregion
```
<div class="l-sub-section">
<div class="alert is-helpful">
The `src/app/app.module.ts` file has a good example of a nested region.
@ -726,7 +698,7 @@ By adding `<live-example>` to the page you generate links that run sample code i
Live examples (AKA "stackblitz") are defined by one or more `stackblitz.json` files in the root of a code sample folder. Each sample folder usually has a single unnamed definition file, the default `stackblitz.json`.
<div class="l-sub-section">
<div class="alert is-helpful">
You can create additional, named definition files in the form `name.stackblitz.json`. See `content/examples/testing` for examples.
@ -826,14 +798,14 @@ Here's an embedded live example for this guide.
Every section header tag is also an anchor point. Another guide page could add a link to this section by writing:
<div class="l-sub-section">
<div class="alert is-helpful">
See the ["Anchors"](guide/docs-style-guide#anchors "Style Guide - Anchors") section for details.
</div>
```html
<div class="l-sub-section">
<div class="alert is-helpful">
See the ["Anchors"](guide/docs-style-guide#anchors "Style Guide - Anchors") section for details.
@ -875,7 +847,7 @@ Now [link to that custom anchor name](#ugly-anchors) as you did before.
Now [link to that custom anchor name](#ugly-anchors) as you did before.
```
<div class="l-sub-section">
<div class="alert is-helpful">
Alternatively, you can use the HTML `<a>` tag.
@ -889,44 +861,81 @@ If you do, be sure to set the `id` attribute - not the `name` attribute! The doc
</div>
## Alerts
## Alerts and Calllouts
Alerts draw attention to important points. Alerts should not be used for multi-line content (use callouts insteads) or stacked on top of each other. Note that the content of an alert is indented to the right by two spaces.
Alerts and callouts present warnings, extra detail or references to other pages. They can also be used to provide commentary that _enriches_ the reader's understanding of the content being presented.
An alert or callout _must not_ contain anything _essential_ to that understanding. Don't put a critical instruction or a tutorial step in a subsection.
### Alerts
Alerts draw attention to short important points. Alerts should not be used for multi-line content (use [callouts](#callouts "callouts") instead).
<div class="alert is-helpful">
You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples").
</div>
Note that at least one blank line must follow both the opening and closing `<div>` tags. A blank line before the closing `</div>` is customary but not required.
```html
<div class="alert is-helpful">
You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples").
</div>
```
There are three different _urgency levels_ used to style the alerts based on the severity or importance of the content.
<div class="alert is-critical">
A critical alert.
</div>
<div class="alert is-important">
An important alert.
</div>
<div class="alert is-helpful">
A helpful, informational alert.
</div>
Here is the markup for these alerts.
```html
<div class="alert is-critical">
A critical alert.
</div>
<div class="alert is-important">
An important alert.
</div>
<div class="alert is-helpful">
A helpful, informational alert.
</div>
```
Alerts are meant to grab the user's attention and should be used sparingly.
They are not for casual asides or commentary. Use [subsections](#subsections "subsections") for commentary.
### Callouts
## Callouts
Callouts, like alerts, are meant to draw attention to important points. Use a callout when you want a riveting header and multi-line content.
Callouts (like alerts) are meant to draw attention to important points. Use a callout when you want a riveting header and multi-line content.
If you have more than two paragraphs, consider creating a new page or making it part of the main content.
Callouts use the same _urgency levels_ that alerts do.
<div class="callout is-critical">
<header>A critical point</header>
@ -943,7 +952,7 @@ Callouts (like alerts) are meant to draw attention to important points. Use a ca
</div>
<div class="callout is-helpful">
<header>A helpful point</header>
<header>A helpful or informational point</header>
**Pitchfork hoodie semiotics**, roof party pop-up _paleo_ messenger bag cred Carles tousled Truffaut yr. Semiotics viral freegan VHS, Shoreditch disrupt McSweeney's. Intelligentsia kale chips Vice four dollar toast, Schlitz crucifix
@ -959,10 +968,10 @@ Here is the markup for the first of these callouts.
</div>
```
Notice that
* the callout header text is forced to all upper case.
* the callout body can be written in markdown.
* a blank line separates the `</header>` tag from the markdown content.
Notice that:
* the callout header text is forced to all upper case
* the callout body can be written in markdown
* a blank line separates the `</header>` tag from the markdown content
Callouts are meant to grab the user's attention. They are not for casual asides. Please use them sparingly.
@ -1254,7 +1263,7 @@ Note that you generally don't wrap a floating image in a `<figure>` element.
If you have a floating image inside an alert, callout, or a subsection, it is a good idea to apply the `clear-fix` class to the `div` to ensure that the image doesn't overflow its container. For example:
<div class="l-sub-section clear-fix">
<div class="alert is-helpful clear-fix">
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying Angular hero"
@ -1266,7 +1275,7 @@ If you have a floating image inside an alert, callout, or a subsection, it is a
</div>
```html
<div class="l-sub-section clear-fix">
<div class="alert is-helpful clear-fix">
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying Angular hero"

View File

@ -101,7 +101,7 @@ The `loadComponent()` method is doing a lot of the heavy lifting here.
Take it step by step. First, it picks an ad.
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -11,7 +11,7 @@ The `@angular/elements` package exports a `createCustomElement()` API that provi
Transforming a component to a custom element makes all of the required Angular infrastructure available to the browser.
Creating a custom element is simple and straightforward, and automatically connects your component-defined view with change detection and data binding, mapping Angular functionality to the corresponding native HTML equivalents.
<div class="l-sub-section">
<div class="alert is-helpful">
We are working on custom elements that can be used by web apps built on other frameworks.
A minimal, self-contained version of the Angular framework will be injected as a service to support the component's change-detection and data-binding functionality.

View File

@ -9,7 +9,7 @@ This page shows how to validate user input in the UI and display useful validati
using both reactive and template-driven forms. It assumes some basic knowledge of the two
forms modules.
<div class="l-sub-section">
<div class="alert is-helpful">
If you're new to forms, start by reviewing the [Forms](guide/forms) and
[Reactive Forms](guide/reactive-forms) guides.
@ -51,7 +51,7 @@ but only if the `name` is invalid and the control is either `dirty` or `touched`
There are messages for `required`, `minlength`, and `forbiddenName`.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -178,7 +178,7 @@ Once the `ForbiddenValidatorDirective` is ready, you can simply add its selector
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
You may have noticed that the custom validation directive is instantiated with `useExisting`
rather than `useClass`. The registered validator must be _this instance_ of
@ -211,7 +211,7 @@ set the color of each form control's border.
## Cross field validation
This section shows how to perform cross field validation. It assumes some basic knowledge of creating custom validators.
<div class="l-sub-section">
<div class="alert is-helpful">
If you haven't created custom validators before, start by reviewing the [custom validators section](guide/form-validation#custom-validators).

View File

@ -29,7 +29,7 @@ You can run the <live-example></live-example> in Stackblitz and download the cod
You can build forms by writing templates in the Angular [template syntax](guide/template-syntax) with
the form-specific directives and techniques described in this page.
<div class="l-sub-section">
<div class="alert is-helpful">
You can also use a reactive (or model-driven) approach to build forms.
However, this page focuses on template-driven forms.
@ -62,7 +62,7 @@ If you delete the hero name, the form displays a validation error in an attentio
Note that the *Submit* button is disabled, and the "required" bar to the left of the input control changes from green to red.
<div class="l-sub-section">
<div class="alert is-helpful">
You can customize the colors and location of the "required" bar with standard CSS.
@ -180,7 +180,7 @@ Update it with the following:
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
There are two changes:
@ -208,7 +208,7 @@ Replace the contents of its template with the following:
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
There are only two changes.
The `template` is simply the new element tag identified by the component's `selector` property.
@ -235,7 +235,7 @@ You added a *Submit* button at the bottom with some classes on it for styling.
*You're not using Angular yet*. There are no bindings or extra directives, just layout.
<div class="l-sub-section">
<div class="alert is-helpful">
In template driven forms, if you've imported `FormsModule`, you don't have to do anything
to the `<form>` tag in order to make use of `FormsModule`. Continue on to see how this works.
@ -311,7 +311,7 @@ Find the `<input>` tag for *Name* and update it like this:
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
You added a diagnostic interpolation after the input tag
so you can see what you're doing.
@ -331,7 +331,7 @@ a template variable for the form. Update the `<form>` tag with
The variable `heroForm` is now a reference to the `NgForm` directive that governs the form as a whole.
<div class="l-sub-section">
<div class="alert is-helpful">
{@a ngForm}
@ -362,7 +362,7 @@ At some point it might look like this:
The diagnostic is evidence that values really are flowing from the input box to the model and
back again.
<div class="l-sub-section">
<div class="alert is-helpful">
That's *two-way data binding*.
For more information, see
@ -375,7 +375,7 @@ Notice that you also added a `name` attribute to the `<input>` tag and set it to
which makes sense for the hero's name. Any unique value will do, but using a descriptive name is helpful.
Defining a `name` attribute is a requirement when using `[(ngModel)]` in combination with a form.
<div class="l-sub-section">
<div class="alert is-helpful">
Internally, Angular creates `FormControl` instances and
registers them with an `NgForm` directive that Angular attached to the `<form>` tag.
@ -395,7 +395,7 @@ After revision, the core of the form should look like this:
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
* Each input element has an `id` property that is used by the `label` element's `for` attribute
to match the label to its input control.
@ -571,7 +571,7 @@ Here's an example of an error message added to the _name_ input box:
You need a template reference variable to access the input box's Angular control from within the template.
Here you created a variable called `name` and gave it the value "ngModel".
<div class="l-sub-section">
<div class="alert is-helpful">
Why "ngModel"?
A directive's [exportAs](api/core/Directive) property
@ -687,7 +687,7 @@ For you, it was as simple as this:
Submitting the form isn't terribly dramatic at the moment.
<div class="l-sub-section">
<div class="alert is-helpful">
An unsurprising observation for a demo. To be honest,
jazzing it up won't teach you anything new about forms.

View File

@ -24,7 +24,7 @@ An Angular application is a tree of components. Each component instance has its
The tree of components parallels the tree of injectors.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -61,7 +61,7 @@ The requests keep bubbling up until Angular finds an injector that can handle th
If it runs out of ancestors, Angular throws an error.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -196,7 +196,7 @@ Providing the service at the component level ensures that _every_ instance of th
No tax return overwriting. No mess.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -244,7 +244,7 @@ its injector produces an instance of `Car` resolved by injector (C) with an `Eng
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -497,7 +497,7 @@ and displays search results as they arrive.
A search value reaches the service only if it's a new value and the user has stopped typing.
<div class="l-sub-section">
<div class="alert is-helpful">
The `withRefresh` option is explained [below](#cache-refresh).
@ -517,7 +517,7 @@ it cancels that request and sends a new one.
server returns them out of order.
<div class="l-sub-section">
<div class="alert is-helpful">
If you think you'll reuse this debouncing logic,
consider moving it to a utility function or into the `PackageSearchService` itself.
@ -622,7 +622,7 @@ Then import and add it to the `AppModule` _providers array_ like this:
As you create new interceptors, add them to the `httpInterceptorProviders` array and
you won't have to revisit the `AppModule`.
<div class="l-sub-section">
<div class="alert is-helpful">
There are many more interceptors in the complete sample code.
@ -824,7 +824,7 @@ and emits again later with the updated search results.
The _cache-then-refresh_ option is triggered by the presence of a **custom `x-refresh` header**.
<div class="l-sub-section">
<div class="alert is-helpful">
A checkbox on the `PackageSearchComponent` toggles a `withRefresh` flag,
which is one of the arguments to `PackageSearchService.search()`.

View File

@ -108,7 +108,7 @@ import from `@angular/common/locales/extra`. An error message informs you when t
<code-example path="i18n/doc-files/app.locale_data_extra.ts" region="import-locale-extra" title="src/app/app.module.ts" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
All locale data used by Angular are extracted from the Unicode Consortium's
<a href="http://cldr.unicode.org/" title="CLDR">Common Locale Data Repository (CLDR)</a>.
@ -118,7 +118,7 @@ import from `@angular/common/locales/extra`. An error message informs you when t
## Template translations
<div class="l-sub-section">
<div class="alert is-helpful">
This document refers to a unit of translatable text as "text," a "message", or a
"text message."
@ -325,7 +325,7 @@ the number of minutes.
* The third parameter defines a pluralization pattern consisting of pluralization categories and their matching values.
<div class="l-sub-section">
<div class="alert is-helpful">
This syntax conforms to the
<a href="http://userguide.icu-project.org/formatparse/messages" title="ICU Message Format">ICU Message Format</a>
@ -352,7 +352,7 @@ Any unmatched cardinality uses `other {{{minutes}} minutes ago}`. You could choo
for two, three, or any other number if the pluralization rules were different. For the example of
"minute", only these three patterns are necessary in English.
<div class="l-sub-section">
<div class="alert is-helpful">
You can use interpolations and html markup inside of your translations.
@ -399,7 +399,7 @@ By default, the tool generates a translation file named `messages.xlf` in the
<a href="https://en.wikipedia.org/wiki/XLIFF">XML Localization Interchange File Format
(XLIFF, version 1.2)</a>.
<div class="l-sub-section">
<div class="alert is-helpful">
If you don't use the CLI, you have two options:
* You can use the `ng-xi18n` tool directly from the `@angular/compiler-cli` package.
@ -430,7 +430,7 @@ ng xi18n --i18n-format=xmb
The sample in this guide uses the default XLIFF 1.2 format.
<div class="l-sub-section">
<div class="alert is-helpful">
XLIFF files have the extension .xlf. The XMB format generates .xmb source files but uses
.xtb (XML Translation Bundle: XTB) translation files.
@ -488,7 +488,7 @@ for the project structure to reflect the entire internationalization effort.
One approach is to dedicate a folder to localization and store related assets, such as
internationalization files, there.
<div class="l-sub-section">
<div class="alert is-helpful">
Localization and internationalization are
<a href="https://en.wikipedia.org/wiki/Internationalization_and_localization">different but

View File

@ -300,7 +300,7 @@ The sequence of log messages follows the prescribed hook calling order:
`OnChanges`, `OnInit`, `DoCheck`&nbsp;(3x), `AfterContentInit`, `AfterContentChecked`&nbsp;(3x),
`AfterViewInit`, `AfterViewChecked`&nbsp;(3x), and `OnDestroy`.
<div class="l-sub-section">
<div class="alert is-helpful">
The constructor isn't an Angular hook *per se*.
The log confirms that input properties (the `name` property in this case) have no assigned values at construction.
@ -323,7 +323,7 @@ Go undercover with these two spy hooks to discover when an element is initialize
This is the perfect infiltration job for a directive.
The heroes will never know they're being watched.
<div class="l-sub-section">
<div class="alert is-helpful">
Kidding aside, pay attention to two key points:
@ -373,7 +373,7 @@ Use `ngOnInit()` for two main reasons:
Experienced developers agree that components should be cheap and safe to construct.
<div class="l-sub-section">
<div class="alert is-helpful">
Misko Hevery, Angular team lead,
[explains why](http://misko.hevery.com/code-reviewers-guide/flaw-constructor-does-real-work/)
@ -394,7 +394,7 @@ Remember also that a directive's data-bound input properties are not set until _
That's a problem if you need to initialize the directive based on those properties.
They'll have been set when `ngOnInit()` runs.
<div class="l-sub-section">
<div class="alert is-helpful">
The `ngOnChanges()` method is your first opportunity to access those properties.
Angular calls `ngOnChanges()` before `ngOnInit()` and many times after that.
@ -460,7 +460,7 @@ The hero object *reference* didn't change so, from Angular's perspective, there
Use the `DoCheck` hook to detect and act upon changes that Angular doesn't catch on its own.
<div class="l-sub-section">
<div class="alert is-helpful">
Use this method to detect a change that Angular overlooked.
@ -549,7 +549,7 @@ The *AfterContent* sample explores the `AfterContentInit()` and `AfterContentChe
*Content projection* is a way to import HTML content from outside the component and insert that content
into the component's template in a designated spot.
<div class="l-sub-section">
<div class="alert is-helpful">
AngularJS developers know this technique as *transclusion*.
@ -577,7 +577,7 @@ In this case, the projected content is the `<app-child>` from the parent.
<img src='generated/images/guide/lifecycle-hooks/projected-child-view.png' alt="Projected Content">
</figure>
<div class="l-sub-section">
<div class="alert is-helpful">
The telltale signs of *content projection* are twofold:

View File

@ -71,7 +71,7 @@ as well as dynamically loaded in a pop-up dialog.
This error often means that you haven't declared the directive "x"
or haven't imported the NgModule to which "x" belongs.
<div class="l-sub-section">
<div class="alert is-helpful">
Perhaps you declared "x" in an application sub-module but forgot to export it.
The "x" class isn't visible to other modules until you add it to the `exports` list.

View File

@ -7,7 +7,7 @@ You can download and install these npm packages with the [**npm client**](https:
The [**yarn client**](https://yarnpkg.com/en/) is a popular alternative for downloading and installing npm packages.
The Angular CLI uses `yarn` by default to install npm packages when you create a new project.
<div class="l-sub-section">
<div class="alert is-helpful">
Node.js and npm are essential to Angular development.

View File

@ -34,7 +34,7 @@ An observer object can define any combination of these handlers. If you don't su
An `Observable` instance begins publishing values only when someone subscribes to it. You subscribe by calling the `subscribe()` method of the instance, passing an observer object to receive the notifications.
<div class="l-sub-section">
<div class="alert is-helpful">
In order to show how subscribing works, we need to create a new observable. There is a constructor that you use to create new instances, but for illustration, we can use some static methods on the `Observable` class that create simple observables of frequently used types:
@ -96,7 +96,7 @@ Notice that if you subscribe twice, there will be two separate streams, each emi
<code-example path="observables/src/multicasting.ts" region="multicast_sequence" title="Create a multicast subscriber"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
Multicasting observables take a bit more setup, but they can be useful for certain applications. Later we will look at tools that simplify the process of multicasting, allowing you to take any observable and make it multicasting.
</div>

View File

@ -54,7 +54,7 @@ Angular comes with a stock of pipes such as
They are all available for use in any template.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -123,7 +123,7 @@ As you click the button, the displayed date alternates between
<div class="l-sub-section">
<div class="alert is-helpful">
@ -186,7 +186,7 @@ Your pipe has one such parameter: the `exponent`.
Your pipe's name is `exponentialStrength`.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -390,7 +390,7 @@ For this reason, a pure pipe is preferable when you can live with the change det
When you can't, you *can* use the impure pipe.
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -28,7 +28,7 @@ You need to set up your development environment before you can do anything.
Install **[Node.js® and npm](https://nodejs.org/en/download/)**
if they are not already on your machine.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -73,7 +73,7 @@ The Angular CLI installs the necessary npm packages, creates the project files,
<div class="l-sub-section">
<div class="alert is-helpful">
@ -630,7 +630,7 @@ These files go in the root folder next to `src/`.
</tr>
</table>
<div class="l-sub-section">
<div class="alert is-helpful">
### Next Step

View File

@ -8,7 +8,7 @@ This document contains the practices that we follow to provide you with a leadin
See [Updating your projects](guide/updating "Updating your projects") for information about how to update your apps and libraries to the latest version of Angular.
<div class="l-sub-section">
<div class="alert is-helpful">
The practices described in this document apply to Angular 2.0 and later. If you are currently using AngularJS, see [Upgrading from AngularJS](guide/upgrade "Upgrading from Angular JS"). _AngularJS_ is the name for all v1.x versions of Angular.
@ -57,7 +57,7 @@ This cadence of releases gives you access to new beta features as soon as they a
{@a schedule}
## Release schedule
<div class="l-sub-section">
<div class="alert is-helpful">
Disclaimer: The dates are offered as general guidance and may be adjusted by us when necessary to ensure delivery of a high-quality platform.

View File

@ -75,7 +75,7 @@ Import what you need from it as you would from any other Angular package.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -336,7 +336,7 @@ It has a great deal of useful information including:
</tr>
</table>
<div class="l-sub-section">
<div class="alert is-helpful">
Two older properties are still available. They are less capable than their replacements, discouraged, and may be deprecated in a future Angular version.
@ -756,7 +756,7 @@ Modern HTML5 browsers were the first to support `pushState` which is why many pe
"HTML5 style" URLs.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -866,7 +866,7 @@ Once the application is bootstrapped, the `Router` performs the initial navigati
<div class="l-sub-section">
<div class="alert is-helpful">
@ -919,7 +919,7 @@ The `RouterOutlet` is a directive from the router library that marks
the spot in the template where the router should display the views for that outlet.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -949,7 +949,7 @@ or a URL fragment for jumping to different areas on the page. Query string param
are provided through the `[queryParams]` binding which takes an object (e.g. `{ name: 'value' }`), while the URL fragment
takes a single value bound to the `[fragment]` input binding.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1010,7 +1010,7 @@ The router will select _this_ route if it can't match a route earlier in the con
A wildcard route can navigate to a custom "404 Not Found" component or [redirect](#redirect) to an existing route.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1096,7 +1096,7 @@ In this app, the router should select the route to the `HeroListComponent` only
so set the `pathMatch` value to `'full'`.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1313,7 +1313,7 @@ then replacing `RouterModule.forRoot` in the `imports` array with the `AppRoutin
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1482,7 +1482,7 @@ using the same techniques you learned while creating the `AppRoutingModule`.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1509,7 +1509,7 @@ In the `AppRoutingModule`, you used the static **`RouterModule.forRoot`** method
In a feature module you use the static **`forChild`** method.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1622,7 +1622,7 @@ _before_ the hero routes.
The wildcard route&mdash;which matches _every_ URL&mdash;will intercept the attempt to navigate to a hero route.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1712,7 +1712,7 @@ The router composes the destination URL from the array like this:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1864,7 +1864,7 @@ You need a way to detect when the route parameters change from _within the same
The observable `paramMap` property handles that beautifully.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -1907,7 +1907,7 @@ It's much simpler to write and read:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2062,7 +2062,7 @@ They are **separated by semicolons ";"**
This is *matrix URL* notation&mdash;something you may not have seen before.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2090,7 +2090,7 @@ as this one can.
The list of heroes is unchanged. No hero row is highlighted.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2227,7 +2227,7 @@ The other two `@HostBinding` properties style the display and position of the co
The `HeroDetailComponent` will ease in from the left when routed to and will slide down when navigating away.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2597,7 +2597,7 @@ Navigation _within_ the feature area remains intact even if you change the paren
Here's an example:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2623,7 +2623,7 @@ After the _link parameters array_, add an object with a `relativeTo` property se
The router then calculates the target URL based on the active route's location.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2781,7 +2781,7 @@ In this case there is only the "popup" outlet property and its value is another
You are in effect saying, _when the user clicks this link, display the component associated with the `compose` route in the `popup` outlet_.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2898,7 +2898,7 @@ A guard's return value controls the router's behavior:
* If it returns `false`, the navigation process stops and the user stays put.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3030,7 +3030,7 @@ feature module, a dashboard route and two unfinished components to manage crises
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3207,7 +3207,7 @@ Import and add the `LoginRoutingModule` to the `AppModule` imports as well.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3318,7 +3318,7 @@ This demo does neither. Instead, it asks the user to make that choice explicitly
in a confirmation dialog box that *waits asynchronously for the user's
answer*.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3596,7 +3596,7 @@ and fragment to the next route.
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `queryParamsHandling` feature also provides a `merge` option, which will preserve and combine the current query parameters with any provided query parameters
@ -3630,7 +3630,7 @@ You can use these persistent bits of information for things that need to be prov
authentication tokens or session ids.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3700,7 +3700,7 @@ The lazy loading and re-configuration happen just once, when the route is _first
the module and routes are available immediately for subsequent requests.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3983,7 +3983,7 @@ Let's take the `Hero` routes and migrate them to new URLs. The `Router` checks f
You'll notice two different types of redirects. The first change is from `/heroes` to `/superheroes` without any parameters. This is a straightforward redirect, unlike the change from `/hero/:id` to `/superhero/:id`, which includes the `:id` route parameter. Router redirects also use powerful pattern matching, so the `Router` inspects the URL and replaces route parameters in the `path` with their appropriate destination. Previously, you navigated to a URL such as `/hero/15` with a route parameter `id` of `15`.
<div class="l-sub-section">
<div class="alert is-helpful">
The `Router` also supports [query parameters](#query-parameters) and the [fragment](#fragment) when using redirects.
@ -4195,7 +4195,7 @@ making it the default strategy.
You can switch to the `HashLocationStrategy` with an override during the bootstrapping process if you prefer it.
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -47,7 +47,7 @@ The `pipe()` function is also a method on the RxJS `Observable`, so you use this
RxJS provides many operators, but only a handful are used frequently. For a list of operators and usage samples, visit the [RxJS API Documentation](https://rxjs-dev.firebaseapp.com/api).
<div class="l-sub-section">
<div class="alert is-helpful">
Note that, for Angular apps, we prefer combining operators with pipes, rather than chaining. Chaining is used in many RxJS examples.
</div>
@ -80,7 +80,7 @@ The following converts the previous example to retry the request before catching
<code-example path="rx-library/src/retry-on-error.ts" title="retry operator"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
Do not retry **authentication** requests, since these should only be initiated by user action. We don't want to lock out user accounts with repeated login requests that the user has not initiated.

View File

@ -22,7 +22,7 @@ The HTML `<title>` is in the document `<head>`, outside the body, making it inac
You could grab the browser `document` object and set the title manually.
That's dirty and undermines your chances of running the app outside of a browser someday.
<div class="l-sub-section">
<div class="alert is-helpful">
Running your app outside a browser means that you can take advantage of server-side
pre-rendering for near-instant first app render times and for SEO. It means you could run from

View File

@ -284,7 +284,7 @@ The following are all in `src/`
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -88,7 +88,7 @@ you apply the directive to an element in the HTML template.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -392,7 +392,7 @@ An `NgSwitchCase` displays its host element when its value matches the switch va
The `NgSwitchDefault` displays its host element when no sibling `NgSwitchCase` matches the switch value.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -691,7 +691,7 @@ The directive consumer expects to bind a true/false condition to `[appUnless]`.
That means the directive needs an `appUnless` property, decorated with `@Input`
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -2335,7 +2335,7 @@ Longer file names are far better than _short-but-obscure_ abbreviated names.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -2759,7 +2759,7 @@ Here is a compliant folder and file structure:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3627,7 +3627,7 @@ Yet there is a real danger of that happening accidentally if the `CoreModule` pr
<div class="l-sub-section">
<div class="alert is-helpful">
@ -3802,7 +3802,7 @@ Developers place components on the page as they would native HTML elements and w
</div>
<div class="l-sub-section">
<div class="alert is-helpful">
There are a few cases where you give a component an attribute, such as when you want to augment a built-in element. For example, [Material Design](https://material.angular.io/components/button/overview) uses this technique with `<button mat-button>`. However, you wouldn't use this technique on a custom element.

View File

@ -410,7 +410,7 @@ Your intuition is incorrect! Your everyday HTML mental model is misleading.
In fact, once you start data binding, you are no longer working with HTML *attributes*. You aren't setting attributes.
You are setting the *properties* of DOM elements, components, and directives.
<div class="l-sub-section">
<div class="alert is-helpful">
### HTML attribute vs. DOM property
@ -622,7 +622,7 @@ from a component's data property into a target element property.
You cannot use property binding to pull values *out* of the target element.
You can't bind to a property of the target element to _read_ it. You can only _set_ it.
<div class="l-sub-section">
<div class="alert is-helpful">
Similarly, you cannot use property binding to *call* a method on the target element.
@ -659,7 +659,7 @@ as it is in the following example:
<code-example path="template-syntax/src/app/app.component.html" region="property-binding-3" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
Technically, Angular is matching the name to a directive [input](guide/template-syntax#inputs-outputs),
one of the property names listed in the directive's `inputs` array or a property decorated with `@Input()`.
@ -782,7 +782,7 @@ The template syntax provides specialized one-way bindings for scenarios less wel
You can set the value of an attribute directly with an **attribute binding**.
<div class="l-sub-section">
<div class="alert is-helpful">
This is the only exception to the rule that a binding sets a target property.
This is the only binding that creates and sets an attribute.
@ -872,7 +872,7 @@ It removes the class when the expression is falsy.
<code-example path="template-syntax/src/app/app.component.html" region="class-binding-3" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
While this is a fine way to toggle a single class name,
the [NgClass directive](guide/template-syntax#ngClass) is usually preferred when managing multiple class names at the same time.
@ -899,14 +899,14 @@ The following example conditionally sets the font size in “em” and “%”
<code-example path="template-syntax/src/app/app.component.html" region="style-binding-2" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
While this is a fine way to set a single style,
the [NgStyle directive](guide/template-syntax#ngStyle) is generally preferred when setting several inline styles at the same time.
</div>
<div class="l-sub-section">
<div class="alert is-helpful">
Note that a _style property_ name can be written in either
[dash-case](guide/glossary#dash-case), as shown above, or
@ -958,7 +958,7 @@ of a known directive, as it does in the following example:
<code-example path="template-syntax/src/app/app.component.html" region="event-binding-3" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `myClick` directive is further described in the section
on [aliasing input/output properties](guide/template-syntax#aliasing-io).
@ -1186,7 +1186,7 @@ Adding an `ngClass` property binding to `currentClasses` sets the element's clas
<code-example path="template-syntax/src/app/app.component.html" region="NgClass-1" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
It's up to you to call `setCurrentClasses()`, both initially and when the dependent properties change.
@ -1222,7 +1222,7 @@ Adding an `ngStyle` property binding to `currentStyles` sets the element's style
<code-example path="template-syntax/src/app/app.component.html" region="NgStyle-2" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
It's up to you to call `setCurrentStyles()`, both initially and when the dependent properties change.
@ -1273,7 +1273,7 @@ That `ngModel` directive hides these onerous details behind its own `ngModel` i
<code-example path="template-syntax/src/app/app.component.html" region="NgModel-3" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `ngModel` data property sets the element's value property and the `ngModelChange` event property
listens for changes to the element's value.
@ -1407,7 +1407,7 @@ The `nullHero` will never be displayed.
<code-example path="template-syntax/src/app/app.component.html" region="NgIf-2" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
See also the
[_safe navigation operator_](guide/template-syntax#safe-navigation-operator "Safe navigation operator (?.)")
@ -1492,7 +1492,7 @@ The next example captures the `index` in a variable named `i` and displays it wi
<code-example path="template-syntax/src/app/app.component.html" region="NgFor-3" title="src/app/app.component.html" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
`NgFor` is implemented by the `NgForOf` directive. Read more about the other `NgForOf` context values such as `last`, `even`,
and `odd` in the [NgForOf API reference](api/common/NgForOf).
@ -1756,7 +1756,7 @@ because the data bound properties are annotated with `@Input()` and `@Output()`
<code-example path="template-syntax/src/app/hero-detail.component.ts" region="input-output-1" title="src/app/hero-detail.component.ts" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
Alternatively, you can identify members in the `inputs` and `outputs` arrays
of the directive metadata, as in this example:
@ -1811,7 +1811,7 @@ You can specify the alias for the property name by passing it into the input/out
<code-example path="template-syntax/src/app/click.directive.ts" region="output-myClick" title="src/app/click.directive.ts" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
You can also alias property names in the `inputs` and `outputs` arrays.
You write a colon-delimited (`:`) string with

View File

@ -466,7 +466,7 @@ simply declares `BannerComponent`, the component to test.
region="configureTestingModule">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
There's no need to declare or import anything else.
The default test module is pre-configured with
@ -917,7 +917,7 @@ so it is safe to call `TestBed.get()` as follows:
title="TestBed injector">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
For a use case in which `TestBed.get()` does not work,
see the section [_Override a component's providers_](#component-override), which
@ -951,7 +951,7 @@ And here are some tests:
The first is a sanity test; it confirms that the stubbed `UserService` is called and working.
<div class="l-sub-section">
<div class="alert is-helpful">
The second parameter to the Jasmine matcher (e.g., `'expected name'`) is an optional failure label.
If the expectation fails, Jasmine displays appends this label to the expectation failure message.
@ -1407,7 +1407,7 @@ The `DashboardComponent` depends on the Angular router and the `HeroService`.
You'd probably have to replace them both with test doubles, which is a lot of work.
The router seems particularly challenging.
<div class="l-sub-section">
<div class="alert is-helpful">
The [discussion below](#routing-component) covers testing components that require the router.
@ -1493,7 +1493,7 @@ The test assumes (correctly in this case) that the runtime
event handler&mdash;the component's `click()` method&mdash;doesn't
care about the event object.
<div class="l-sub-section">
<div class="alert is-helpful">
Other handlers are less forgiving. For example, the `RouterLink`
directive expects an object with a `button` property
@ -1696,7 +1696,7 @@ for the `id` to change during its lifetime.
<code-example path="testing/src/app/hero/hero-detail.component.ts" region="ng-on-init" title="app/hero/hero-detail.component.ts (ngOnInit)" linenums="false"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The [Router](guide/router#route-parameters) guide covers `ActivatedRoute.paramMap` in more detail.
@ -1743,7 +1743,7 @@ Here's a test demonstrating the component's behavior when the observed `id` refe
<code-example path="testing/src/app/hero/hero-detail.component.spec.ts" region="route-good-id" title="app/hero/hero-detail.component.spec.ts (existing id)" linenums="false"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `createComponent()` method and `page` object are discussed [below](#page-object).
Rely on your intuition for now.
@ -1927,7 +1927,7 @@ which sets the stub's telltale `navigatedTo` property.
Tests inspect `navigatedTo` to confirm that clicking the anchor
set the expected route definition.
<div class="l-sub-section">
<div class="alert is-helpful">
Whether the router is configured properly to navigate with that route definition is a
question for a separate set of tests.
@ -1971,7 +1971,7 @@ as expected:
<code-example path="testing/src/app/app.component.spec.ts" region="tests" title="app/app.component.spec.ts (selected tests)" linenums="false"></code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The "click" test _in this example_ is misleading.
It tests the `RouterLinkDirectiveStub` rather than the _component_.
@ -2258,7 +2258,7 @@ One approach is to configure the testing module from the individual pieces as in
title="app/hero/hero-detail.component.spec.ts (FormsModule setup)" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
Notice that the `beforeEach()` is asynchronous and calls `TestBed.compileComponents`
because the `HeroDetailComponent` has an external template and css file.
@ -2329,7 +2329,7 @@ And `TestBed.configureTestingModule` can't configure them either.
Angular has been creating new instances of the real `HeroDetailService` all along!
<div class="l-sub-section">
<div class="alert is-helpful">
These tests could fail or timeout if the `HeroDetailService` made its own XHR calls to a remote server.
There might not be a remote server to call.
@ -2462,7 +2462,7 @@ A better solution is to create an artificial test component that demonstrates al
<img src='generated/images/guide/testing/highlight-directive-spec.png' alt="HighlightDirective spec in action">
</figure>
<div class="l-sub-section">
<div class="alert is-helpful">
The `<input>` case binds the `HighlightDirective` to the name of a color value in the input box.
The initial value is the word "cyan" which should be the background color of the input box.
@ -2602,7 +2602,7 @@ Here's a summary of the stand-alone functions, in order of likely utility:
Simulates the passage of time and the completion of pending asynchronous activities
by flushing both _timer_ and _micro-task_ queues within the _fakeAsync test zone_.
<div class="l-sub-section">
<div class="alert is-helpful">
The curious, dedicated reader might enjoy this lengthy blog post,
["_Tasks, microtasks, queues and schedules_"](https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/).
@ -3221,7 +3221,7 @@ Here are the most useful `DebugElement` members for testers, in approximate orde
The immediate `DebugElement` children. Walk the tree by descending through `children`.
<div class="l-sub-section">
<div class="alert is-helpful">
`DebugElement` also has `childNodes`, a list of `DebugNode` objects.
`DebugElement` derives from `DebugNode` objects and there are often

View File

@ -21,7 +21,7 @@ that are important to Angular developers, including details about the following
Typically, you add a TypeScript configuration file called `tsconfig.json` to your project to
guide the compiler as it generates JavaScript files.
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -13,7 +13,7 @@ It can also pre-generate pages as HTML files that you serve later.
This guide describes a Universal sample application that launches quickly as a server-rendered page.
Meanwhile, the browser downloads the full client version and switches to it automatically after the code loads.
<div class="l-sub-section">
<div class="alert is-helpful">
[Download the finished sample code](generated/zips/universal/universal.zip),
which runs in a [Node.js® Express](https://expressjs.com/) server.
@ -253,7 +253,7 @@ Note how the constructor prepends the origin (if it exists) to the `heroesUrl`.
You don't provide `APP_BASE_HREF` in the browser version, so the `heroesUrl` remains relative.
<div class="l-sub-section">
<div class="alert is-helpful">
You can ignore `APP_BASE_HREF` in the browser if you've specified `<base href="/">` in the `index.html`
to satisfy the router's need for a base address, as the tutorial sample does.
@ -309,7 +309,7 @@ It may respond to data requests, perhaps directly or as a proxy to a separate da
The sample web server for _this_ guide is based on the popular [Express](https://expressjs.com/) framework.
<div class="l-sub-section">
<div class="alert is-helpful">
_Any_ web server technology can serve a Universal app as long as it can call Universal's `renderModuleFactory`.
The principles and decision points discussed below apply to any web server technology that you chose.
@ -357,7 +357,7 @@ It's up to your engine to decide what to do with that page.
_This engine's_ promise callback returns the rendered page to the [web server](#web-server),
which then forwards it to the client in the HTTP response.
<div class="l-sub-section">
<div class="alert is-helpful">
This wrappers are very useful to hide the complexity of the `renderModuleFactory`. There are more wrappers for different backend technologies
at the [Universal repository](https://github.com/angular/universal).
@ -392,7 +392,7 @@ You configure the Express server pipeline with calls to `app.get()` like this on
<code-example path="universal/server.ts" title="server.ts (data URL)" region="data-request" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
This sample server doesn't handle data requests.

View File

@ -8,7 +8,7 @@ For information about our versioning policy and practices&mdash;including
support and deprecation practices, as well as the release schedule&mdash;see [Angular versioning and releases](guide/releases "Angular versioning and releases").
<div class="l-sub-section">
<div class="alert is-helpful">
If you are currently using AngularJS, see [Upgrading from AngularJS](guide/upgrade "Upgrading from Angular JS"). _AngularJS_ is the name for all v1.x versions of Angular.

View File

@ -385,7 +385,7 @@ That means that you need at least one module each from both AngularJS and Angula
You will import `UpgradeModule` inside the NgModule, and then use it for
bootstrapping the AngularJS module.
<div class="l-sub-section">
<div class="alert is-helpful">
For more information, see [NgModules](guide/ngmodules).
@ -444,7 +444,7 @@ In the constructor of the `AppModule`, use dependency injection to get a hold of
and use it to bootstrap the AngularJS app in the `AppModule.ngDoBootstrap` method.
The `upgrade.bootstrap` method takes the exact same arguments as [angular.bootstrap](https://docs.angularjs.org/api/ng/function/angular.bootstrap):
<div class="l-sub-section">
<div class="alert is-helpful">
Note that you do not add a `bootstrap` declaration to the `@NgModule` decorator, since
AngularJS will own the root template of the application.
@ -490,7 +490,7 @@ NgModule.
<code-example path="upgrade-module/src/app/downgrade-static/app.module.ts" region="ngmodule" title="app.module.ts">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
All Angular components, directives and pipes must be declared in an NgModule.
@ -1107,7 +1107,7 @@ can verify you're calling their APIs with the correct kinds of arguments.
<code-example path="upgrade-phonecat-1-typescript/app/app.config.ts" title="app/app.config.ts">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The [AngularJS 1.x type definitions](https://www.npmjs.com/package/@types/angular)
you installed are not officially maintained by the Angular team,
@ -1280,7 +1280,7 @@ so it is already being loaded by the browser.
Now you're running both AngularJS and Angular at the same time. That's pretty
exciting! You're not running any actual Angular components yet. That's next.
<div class="l-sub-section">
<div class="alert is-helpful">
#### Why declare _angular_ as _angular.IAngularStatic_?
@ -1640,7 +1640,7 @@ and let that directive construct the appropriate URL to the `PhoneDetailComponen
<code-example path="upgrade-phonecat-3-final/app/phone-list/phone-list.template.html" region="list" title="app/phone-list/phone-list.template.html (list with links)" linenums="false">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
See the [Routing](guide/router) page for details.

View File

@ -96,7 +96,7 @@ Here's what the UI displays:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -179,7 +179,7 @@ Type something in the input box, and watch the display update with each keystrok
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -7,7 +7,7 @@ Some developers prefer Visual Studio as their Integrated Development Environment
This cookbook describes the steps required to set up and use the
Angular QuickStart files in **Visual Studio 2015 within an ASP.NET 4.x project**.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -25,7 +25,7 @@ the QuickStart application itself.
To set up the QuickStart files with an **ASP.NET 4.x project** in
Visual Studio 2015, follow these steps:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -49,7 +49,7 @@ Note that the resulting code does not map to the docs. Adjust accordingly.
Install **[Node.js® and npm](https://nodejs.org/en/download/)**
if they are not already on your machine.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -146,7 +146,7 @@ Create the ASP.NET 4.x project in the usual way as follows:
* Select the desired ASP.NET 4.5.2 template and click OK.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -281,7 +281,7 @@ rewrite rules near the bottom of the `web.config`:
<div class="l-sub-section">
<div class="alert is-helpful">
@ -299,7 +299,7 @@ match the base href in `index.html`.
Build and launch the app with debugger by clicking the **Run** button or by pressing `F5`.
<div class="l-sub-section">
<div class="alert is-helpful">

View File

@ -7,28 +7,37 @@
<p>We'd love for you to contribute to our source code and to make Angular projects even better.</p>
<div class="l-sub-section">
<div class="card-section">
<div>
<h3 class="no-anchor">Angular</h3>
Angular is a next generation mobile and desktop application development platform.
<a href="https://github.com/angular/angular/blob/master/CONTRIBUTING.md" class="button" md-button>Contribute to Angular</a>
</div>
<a href="https://github.com/angular/angular/blob/master/CONTRIBUTING.md" class="button button-blue" md-button>Contribute</a>
</div>
<div class="l-sub-section">
<div class="card-section">
<div>
<h3 class="no-anchor">Angular Material</h3>
Our goal is to deliver a lean, lightweight set of Angular-based UI elements that implement the material design specification for use in Angular single-page applications (SPAs).
Our goal is to deliver a lean, lightweight set of Angular-based UI elements that implement the material design specification
for use in Angular single-page applications (SPAs).
<a href="https://github.com/angular/material2/blob/master/CONTRIBUTING.md" class="button" md-button>Contribute to Angular Material</a>
</div>
<div class="l-sub-section">
<a href="https://github.com/angular/material2/blob/master/CONTRIBUTING.md" class="button button-blue" md-button>Contribute</a>
</div>
<div class="card-section">
<div>
<h3 class="no-anchor">AngularFire</h3>
AngularFire is the officially supported Angular binding for Firebase. Firebase is a full backend so you don't need servers to build your Angular app.
AngularFire is the officially supported Angular binding for Firebase. Firebase is a full backend so you don't need servers
to build your Angular app.
<a href="https://github.com/angular/angularfire2" class="button" md-button> Contribute to AngularFire</a>
</div>
<a href="https://github.com/angular/angularfire2" class="button button-blue" md-button> Contribute</a>
</div>
</article>

View File

@ -19,7 +19,7 @@ Create a new project named `angular-tour-of-heroes` with this CLI command.
The Angular CLI generated a new project with a default application and supporting files.
<div class="l-sub-section">
<div class="alert is-helpful">
@ -41,7 +41,7 @@ Go to the project directory and launch the application.
ng serve --open
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The `ng serve` command builds the app, starts the development server,
watches the source files, and rebuilds the app as you make changes to those files.

View File

@ -87,7 +87,7 @@ If you look at the `@Injectable()` statement right before the `HeroService` clas
When you provide the service at the root level, Angular creates a single, shared instance of `HeroService` and injects into any class that asks for it.
Registering the provider in the `@Injectable` metadata also allows Angular to optimize an app by removing the service if it turns out not to be used after all.
<div class="l-sub-section">
<div class="alert is-helpful">
If you need to, you can register providers at different levels:
in the `HeroesComponent`, in the `AppComponent`, in the `AppModule`.
@ -213,7 +213,7 @@ Replace the `getHeroes` method with this one.
`of(HEROES)` returns an `Observable<Hero[]>` that emits _a single value_, the array of mock heroes.
<div class="l-sub-section">
<div class="alert is-helpful">
In the [HTTP tutorial](tutorial/toh-pt6), you'll call `HttpClient.get<Hero[]>()` which also returns an `Observable<Hero[]>` that emits _a single value_, an array of heroes from the body of the HTTP response.
@ -320,7 +320,7 @@ when it creates the `HeroService`.
path="toh-pt4/src/app/hero.service.ts" region="ctor">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
This is a typical "*service-in-service*" scenario:
you inject the `MessageService` into the `HeroService` which is injected into the `HeroesComponent`.

View File

@ -28,7 +28,7 @@ Use the CLI to generate it.
ng generate module app-routing --flat --module=app
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
`--flat` puts the file in `src/app` instead of its own folder.<br>
`--module=app` tells the CLI to register it in the `imports` array of the `AppModule`.
@ -91,7 +91,7 @@ configure it with the `routes` in one step by calling
region="ngmodule-imports">
</code-example>
<div class="l-sub-section">
<div class="alert is-helpful">
The method is called `forRoot()` because you configure the router at the application's root level.
The `forRoot()` method supplies the service providers and directives needed for routing,
@ -112,7 +112,7 @@ You removed `<app-heroes>` because you will only display the `HeroesComponent` w
The `<router-outlet>` tells the router where to display routed views.
<div class="l-sub-section">
<div class="alert is-helpful">
The `RouterOutlet` is one of the router directives that became available to the `AppComponent`
because `AppModule` imports `AppRoutingModule` which exported `RouterModule`.
@ -165,7 +165,7 @@ but not the heroes list.
Click the link.
The address bar updates to `/heroes` and the list of heroes appears.
<div class="l-sub-section">
<div class="alert is-helpful">
Make this and future navigation links look better by adding private CSS styles to `app.component.css`
as listed in the [final code review](#appcomponent) below.

View File

@ -158,7 +158,7 @@ Applying the optional type specifier, `<Hero[]>` , gives you a typed result obje
The shape of the JSON data is determined by the server's data API.
The _Tour of Heroes_ data API returns the hero data as an array.
<div class="l-sub-section">
<div class="alert is-helpful">
Other APIs may bury the data that you want within an object.
You might have to dig that data out by processing the `Observable` result
@ -536,7 +536,7 @@ before passing along the latest string. You'll never make requests more frequent
It cancels and discards previous search observables, returning only the latest search service observable.
<div class="l-sub-section">
<div class="alert is-helpful">
With the [switchMap operator](http://www.learnrxjs.io/operators/transformation/switchmap.html),
every qualifying key event can trigger an `HttpClient.get()` method call.

View File

@ -5,9 +5,14 @@
color: $darkgray;
width: 100%;
box-sizing: border-box;
clear: both;
h1, h2, h3, h4, h5, h6 {
font-weight: 500;
}
&.is-critical {
border-left: 10px solid $brightred;
border-left: 8px solid $brightred;
background-color: rgba($brightred, 0.05);
h1, h2, h3, h4, h5, h6 {
@ -16,7 +21,7 @@
}
&.is-important {
border-left: 10px solid $orange;
border-left: 8px solid $orange;
background-color: rgba($orange, 0.05);
h1, h2, h3, h4, h5, h6 {
@ -25,7 +30,7 @@
}
&.is-helpful {
border-left: 10px solid $blue;
border-left: 8px solid $blue;
background-color: rgba($blue, 0.05);
h1, h2, h3, h4, h5, h6 {
@ -34,7 +39,6 @@
}
> * {
margin: 0;
padding: 8px 16px;
margin: 8px 16px;
}
}

View File

@ -48,11 +48,19 @@ a.button.mat-button {
&.button-subtle {
background: $mediumgray;
color: darken($offwhite, 10%);
&:hover {
color: rgba($white, 0.7);
}
}
&.button-navy {
&.button-blue {
background: $blue;
color: rgba($white, .87);
&:hover {
color: rgba($white, 0.7);
}
}
&.button-banner {

View File

@ -8,6 +8,8 @@
color: $white;
line-height: 24px;
font-weight: 500;
padding: 8px 16px;
margin: 0;
text-transform: uppercase;
border-radius: 4px 4px 0 0;
}

View File

@ -73,3 +73,26 @@
text-align: center;
}
}
.card-section {
@include card(auto, 90%);
padding: 16px 32px;
margin: 16px 0;
display: flex;
flex-direction: row;
align-items: center;
// Removes on-hover effect from card mixin
&:hover {
box-shadow: 0 2px 2px rgba($black, 0.24), 0 0 2px rgba($black, 0.12);
}
h1, h2, h3, h4, h5, h6 {
margin: 8px 0;
}
a, .button, button {
text-align: center;
}
}

View File

@ -3,9 +3,14 @@
margin: 0;
}
.l-sub-section {
width: 90%;
margin-bottom: 20px;
.card-section {
justify-content: space-between;
max-width: 880px;
> :first-child {
margin-right: 2rem;
width: 60%;
}
&:last-child {
margin-bottom: 0;

View File

@ -24,7 +24,6 @@
@import 'resources';
@import 'scrollbar';
@import 'search-results';
@import 'subsection';
@import 'toc';
@import 'select-menu';
@import 'deploy-theme';

View File

@ -1,20 +0,0 @@
.l-sub-section {
color: $darkgray;
background-color: rgba($blue, 0.05);
border-left: 8px solid $blue;
padding: 16px;
margin-bottom: 8px;
display: table;
clear: both;
width: 100%;
box-sizing: border-box;
h3 {
margin: 8px 0 0;
}
a:hover {
color: $blue;
text-decoration: underline;
}
}

View File

@ -18,7 +18,7 @@
page-break-after: avoid;
}
ul, ol, img, code-example, table, tr, .alert, .l-subsection, .feature {
ul, ol, img, code-example, table, tr, .alert, .feature {
page-break-inside: avoid;
}