diff --git a/aio/content/guide/animations.md b/aio/content/guide/animations.md index e9f86a201d..b214696d0a 100644 --- a/aio/content/guide/animations.md +++ b/aio/content/guide/animations.md @@ -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. -
+
The examples in this page are available as a . @@ -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. -
+
These two common animations have their own aliases: diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index 2bc21dc8dd..8516201de7 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -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. -
+
Watch compiler author Tobias Bosch explain the Angular Compiler at AngularConnect 2016. @@ -39,7 +39,7 @@ For AOT compilation, append the `--aot` flags to the _build-only_ or the _build- ng serve --aot -
+
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). -
+
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. -
+
If you want `ngc` to report syntax errors immediately rather than produce a `.metadata.json` file with errors, set the `strictMetadataEmit` option in `tsconfig`. diff --git a/aio/content/guide/architecture-modules.md b/aio/content/guide/architecture-modules.md index 055baae754..c660fb9cb8 100644 --- a/aio/content/guide/architecture-modules.md +++ b/aio/content/guide/architecture-modules.md @@ -26,7 +26,7 @@ Here's a simple root NgModule definition: -
+
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. -
+
The hierarchical structure of views is a key factor in the way Angular detects and responds to changes in the DOM and app data.
@@ -72,7 +72,7 @@ Other JavaScript modules use *import statements* to access public objects from o -
+ @@ -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. -
+
Learn more from the [NgModules](guide/ngmodules) page. diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md index e1d37bff6c..59476836a1 100644 --- a/aio/content/guide/architecture.md +++ b/aio/content/guide/architecture.md @@ -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_—that is, loading modules on demand—in order to minimize the amount of code that needs to be loaded at startup. -
+
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. -
+
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. -
+
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. -
+
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. -
+
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) -
+
Note that the code referenced on these pages is available as a .
diff --git a/aio/content/guide/attribute-directives.md b/aio/content/guide/attribute-directives.md index 6f5287627a..03c600ab97 100644 --- a/aio/content/guide/attribute-directives.md +++ b/aio/content/guide/attribute-directives.md @@ -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`. -
+
_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. -
+
#### 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 `

` in this case. -

+
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: diff --git a/aio/content/guide/browser-support.md b/aio/content/guide/browser-support.md index 9c91a715d8..fea8cd245a 100644 --- a/aio/content/guide/browser-support.md +++ b/aio/content/guide/browser-support.md @@ -95,7 +95,7 @@ Angular supports most recent browsers. This includes the following specific vers -
+
Angular's continuous integration process runs unit tests of the framework on all of these browsers for every pull request, using SauceLabs and @@ -154,7 +154,7 @@ add it yourself, following the same pattern: 1. install the npm package 1. `import` the file in `polyfills.ts` -
+
Non-CLI users should follow the instructions [below](#non-cli).
diff --git a/aio/content/guide/component-interaction.md b/aio/content/guide/component-interaction.md index 38f9d09b14..fd0ef1c53e 100644 --- a/aio/content/guide/component-interaction.md +++ b/aio/content/guide/component-interaction.md @@ -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. -
+
@@ -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. -
+
@@ -400,7 +400,7 @@ Each `AstronautComponent` is a child of the `MissionControlComponent` and theref -
+
diff --git a/aio/content/guide/component-styles.md b/aio/content/guide/component-styles.md index 1d4eaca201..a5ae119cba 100644 --- a/aio/content/guide/component-styles.md +++ b/aio/content/guide/component-styles.md @@ -187,7 +187,7 @@ They are _not inherited_ by any components nested within the template nor by any
-
+
You can specify more than one styles file or even a combination of `styles` and `styleUrls`. diff --git a/aio/content/guide/dependency-injection-in-action.md b/aio/content/guide/dependency-injection-in-action.md index 358feb1cdf..8d1c222a05 100644 --- a/aio/content/guide/dependency-injection-in-action.md +++ b/aio/content/guide/dependency-injection-in-action.md @@ -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. -
+
@@ -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. -
+
@@ -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*. -
+
@@ -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. -
+
@@ -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). -
+
@@ -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`. -
+
@@ -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. -
+
@@ -866,7 +866,7 @@ and displays them in the order they arrive from the database. -
+
@@ -982,7 +982,7 @@ If you're lucky, they all implement the same base class whose API your `NewsComponent` understands. -
+
@@ -1165,7 +1165,7 @@ its class signature doesn't mention `Parent`: -
+
diff --git a/aio/content/guide/dependency-injection-pattern.md b/aio/content/guide/dependency-injection-pattern.md index d13f2baa3a..93fd0eb113 100644 --- a/aio/content/guide/dependency-injection-pattern.md +++ b/aio/content/guide/dependency-injection-pattern.md @@ -81,7 +81,7 @@ now in the constructor. The `Car` class no longer creates an `engine` or `tires`. It just consumes them. -
+
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. -
+
The _consumer_ of `Car` has the problem. The consumer must update the car creation code to something like this: diff --git a/aio/content/guide/dependency-injection.md b/aio/content/guide/dependency-injection.md index 6d29c2a0f3..b2559ab55d 100644 --- a/aio/content/guide/dependency-injection.md +++ b/aio/content/guide/dependency-injection.md @@ -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. -
+
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. -
+
You'll learn about _injection tokens_ and _provider_ syntax [below](#providers).
@@ -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.. -
+
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. -
+
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: -
+
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 -
+
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: -
+
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. -
+
### 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. -
+
@@ -776,7 +776,7 @@ If you define the component before the service, you'll get a runtime null reference error. -
+
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). diff --git a/aio/content/guide/deployment.md b/aio/content/guide/deployment.md index 58b3a26c27..95e3799a2f 100644 --- a/aio/content/guide/deployment.md +++ b/aio/content/guide/deployment.md @@ -187,7 +187,7 @@ For example, given the ``, 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. -
+
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. -
+
The output folder is `dist/` by default. To output to a different folder, change the `outputPath` in `angular.json`. diff --git a/aio/content/guide/displaying-data.md b/aio/content/guide/displaying-data.md index c5a11d6edc..6f3ba5ea45 100644 --- a/aio/content/guide/displaying-data.md +++ b/aio/content/guide/displaying-data.md @@ -13,7 +13,7 @@ The final UI looks like this: Final UI -
+
@@ -60,7 +60,7 @@ interpolation: -
+
@@ -79,7 +79,7 @@ inserts those values into the browser. Angular updates the display when these properties change. -
+
@@ -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. -
+
diff --git a/aio/content/guide/docs-style-guide.md b/aio/content/guide/docs-style-guide.md index ff2d539930..48d875d8f0 100644 --- a/aio/content/guide/docs-style-guide.md +++ b/aio/content/guide/docs-style-guide.md @@ -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`. -
+
_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.
``` -
+
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 `
` that has the `l-sub-section` CSS class. You should write the subsection content in markdown. - -Here is an example of a subsection `
` surrounding the subsection content written in markdown. - -
- - You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples"). - -
- -```html -
- -You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples"). - -
-``` - -Note that at least one blank line must follow the opening `
`. A blank line before the closing `
` 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. -
+
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. -
+
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 `` and `` components. -
+
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 `` and `` 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_. -
+
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 ``` -
+
The `src/app/app.module.ts` file has a good example of a nested region. @@ -726,7 +698,7 @@ By adding `` 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`. -
+
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: -
+
See the ["Anchors"](guide/docs-style-guide#anchors "Style Guide - Anchors") section for details.
```html -
+
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. ``` -
+ -## 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). + +
+ + You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples"). + +
+ + Note that at least one blank line must follow both the opening and closing `
` tags. A blank line before the closing `
` is customary but not required. + +```html +
+ +You'll learn about styles for live examples in the [section below](guide/docs-style-guide#live-examples "Live examples"). + +
+``` + +There are three different _urgency levels_ used to style the alerts based on the severity or importance of the content.
+ A critical alert. +
+ An important alert. +
+ A helpful, informational alert. +
Here is the markup for these alerts. ```html
+ A critical alert. +
+ An important alert. +
+ A helpful, informational alert. +
``` -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.
A critical point
@@ -943,7 +952,7 @@ Callouts (like alerts) are meant to draw attention to important points. Use a ca
-
A helpful point
+
A helpful or informational point
**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.
``` -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 `` 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 `` 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 `
` 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: -
+
flying Angular hero ```html -
+
flying Angular hero +
diff --git a/aio/content/guide/elements.md b/aio/content/guide/elements.md index 35b86d2370..c6982e3b75 100644 --- a/aio/content/guide/elements.md +++ b/aio/content/guide/elements.md @@ -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. -
+
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. diff --git a/aio/content/guide/form-validation.md b/aio/content/guide/form-validation.md index 5f006b61ca..858ddc0ede 100644 --- a/aio/content/guide/form-validation.md +++ b/aio/content/guide/form-validation.md @@ -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. -
+
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`. -
+
@@ -178,7 +178,7 @@ Once the `ForbiddenValidatorDirective` is ready, you can simply add its selector -
+
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. -
+
If you haven't created custom validators before, start by reviewing the [custom validators section](guide/form-validation#custom-validators). diff --git a/aio/content/guide/forms.md b/aio/content/guide/forms.md index 66a1e36f10..7d11293445 100644 --- a/aio/content/guide/forms.md +++ b/aio/content/guide/forms.md @@ -29,7 +29,7 @@ You can run the 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. -
+
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. -
+
You can customize the colors and location of the "required" bar with standard CSS. @@ -180,7 +180,7 @@ Update it with the following: -
+
There are two changes: @@ -208,7 +208,7 @@ Replace the contents of its template with the following: -
+
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. -
+
In template driven forms, if you've imported `FormsModule`, you don't have to do anything to the `
` tag in order to make use of `FormsModule`. Continue on to see how this works. @@ -311,7 +311,7 @@ Find the `` tag for *Name* and update it like this: -
+
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 `` tag with The variable `heroForm` is now a reference to the `NgForm` directive that governs the form as a whole. -
+
{@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. -
+
That's *two-way data binding*. For more information, see @@ -375,7 +375,7 @@ Notice that you also added a `name` attribute to the `` 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. -
+
Internally, Angular creates `FormControl` instances and registers them with an `NgForm` directive that Angular attached to the `` tag. @@ -395,7 +395,7 @@ After revision, the core of the form should look like this: -
+
* 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". -
+
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. -
+
An unsurprising observation for a demo. To be honest, jazzing it up won't teach you anything new about forms. diff --git a/aio/content/guide/hierarchical-dependency-injection.md b/aio/content/guide/hierarchical-dependency-injection.md index af395f362b..48b671b8bd 100644 --- a/aio/content/guide/hierarchical-dependency-injection.md +++ b/aio/content/guide/hierarchical-dependency-injection.md @@ -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. -
+
@@ -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. -
+
@@ -196,7 +196,7 @@ Providing the service at the component level ensures that _every_ instance of th No tax return overwriting. No mess. -
+
@@ -244,7 +244,7 @@ its injector produces an instance of `Car` resolved by injector (C) with an `Eng -
+
diff --git a/aio/content/guide/http.md b/aio/content/guide/http.md index 92fec8e76a..e2f2df0842 100644 --- a/aio/content/guide/http.md +++ b/aio/content/guide/http.md @@ -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. -
+
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. -
+
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`. -
+
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**. -
+
A checkbox on the `PackageSearchComponent` toggles a `withRefresh` flag, which is one of the arguments to `PackageSearchService.search()`. diff --git a/aio/content/guide/i18n.md b/aio/content/guide/i18n.md index fb94050d96..2009e09cb2 100644 --- a/aio/content/guide/i18n.md +++ b/aio/content/guide/i18n.md @@ -108,7 +108,7 @@ import from `@angular/common/locales/extra`. An error message informs you when t -
+
All locale data used by Angular are extracted from the Unicode Consortium's Common Locale Data Repository (CLDR). @@ -118,7 +118,7 @@ import from `@angular/common/locales/extra`. An error message informs you when t ## Template translations -
+
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. -
+
This syntax conforms to the ICU Message Format @@ -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. -
+
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 XML Localization Interchange File Format (XLIFF, version 1.2). -
+
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. -
+
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. -
+
Localization and internationalization are different but diff --git a/aio/content/guide/lifecycle-hooks.md b/aio/content/guide/lifecycle-hooks.md index 6754d200b3..3556d1674a 100644 --- a/aio/content/guide/lifecycle-hooks.md +++ b/aio/content/guide/lifecycle-hooks.md @@ -300,7 +300,7 @@ The sequence of log messages follows the prescribed hook calling order: `OnChanges`, `OnInit`, `DoCheck` (3x), `AfterContentInit`, `AfterContentChecked` (3x), `AfterViewInit`, `AfterViewChecked` (3x), and `OnDestroy`. -
+
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. -
+
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. -
+
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. -
+
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. -
+
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. -
+
AngularJS developers know this technique as *transclusion*. @@ -577,7 +577,7 @@ In this case, the projected content is the `` from the parent. Projected Content
-
+
The telltale signs of *content projection* are twofold: diff --git a/aio/content/guide/ngmodule-faq.md b/aio/content/guide/ngmodule-faq.md index 980a75a670..d3fdd2e616 100644 --- a/aio/content/guide/ngmodule-faq.md +++ b/aio/content/guide/ngmodule-faq.md @@ -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. -
+
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. diff --git a/aio/content/guide/npm-packages.md b/aio/content/guide/npm-packages.md index dcbd489881..3236f171f0 100644 --- a/aio/content/guide/npm-packages.md +++ b/aio/content/guide/npm-packages.md @@ -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. -
+
Node.js and npm are essential to Angular development. diff --git a/aio/content/guide/observables.md b/aio/content/guide/observables.md index f07e4b2916..fd3f7392f5 100644 --- a/aio/content/guide/observables.md +++ b/aio/content/guide/observables.md @@ -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. -
+
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 -
+
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.
diff --git a/aio/content/guide/pipes.md b/aio/content/guide/pipes.md index 4d2d57ec25..2893ab1ac2 100644 --- a/aio/content/guide/pipes.md +++ b/aio/content/guide/pipes.md @@ -54,7 +54,7 @@ Angular comes with a stock of pipes such as They are all available for use in any template. -
+
@@ -123,7 +123,7 @@ As you click the button, the displayed date alternates between -
+
@@ -186,7 +186,7 @@ Your pipe has one such parameter: the `exponent`. Your pipe's name is `exponentialStrength`. -
+
@@ -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. -
+
diff --git a/aio/content/guide/quickstart.md b/aio/content/guide/quickstart.md index 66eea81611..36ef5e056d 100644 --- a/aio/content/guide/quickstart.md +++ b/aio/content/guide/quickstart.md @@ -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. -
+
@@ -73,7 +73,7 @@ The Angular CLI installs the necessary npm packages, creates the project files, -
+
@@ -630,7 +630,7 @@ These files go in the root folder next to `src/`. -
+
### Next Step diff --git a/aio/content/guide/releases.md b/aio/content/guide/releases.md index 532cc72320..9e09cd8d9e 100644 --- a/aio/content/guide/releases.md +++ b/aio/content/guide/releases.md @@ -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. -
+
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 -
+
Disclaimer: The dates are offered as general guidance and may be adjusted by us when necessary to ensure delivery of a high-quality platform. diff --git a/aio/content/guide/router.md b/aio/content/guide/router.md index d32f8ba9c5..0ecd1c8151 100644 --- a/aio/content/guide/router.md +++ b/aio/content/guide/router.md @@ -75,7 +75,7 @@ Import what you need from it as you would from any other Angular package. -
+
@@ -336,7 +336,7 @@ It has a great deal of useful information including: -
+
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. -
+
@@ -866,7 +866,7 @@ Once the application is bootstrapped, the `Router` performs the initial navigati -
+
@@ -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. -
+
@@ -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. -
+
@@ -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. -
+
@@ -1096,7 +1096,7 @@ In this app, the router should select the route to the `HeroListComponent` only so set the `pathMatch` value to `'full'`. -
+
@@ -1313,7 +1313,7 @@ then replacing `RouterModule.forRoot` in the `imports` array with the `AppRoutin -
+
@@ -1482,7 +1482,7 @@ using the same techniques you learned while creating the `AppRoutingModule`. -
+
@@ -1509,7 +1509,7 @@ In the `AppRoutingModule`, you used the static **`RouterModule.forRoot`** method In a feature module you use the static **`forChild`** method. -
+
@@ -1622,7 +1622,7 @@ _before_ the hero routes. The wildcard route—which matches _every_ URL—will intercept the attempt to navigate to a hero route. -
+
@@ -1712,7 +1712,7 @@ The router composes the destination URL from the array like this: -
+
@@ -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. -
+
@@ -1907,7 +1907,7 @@ It's much simpler to write and read: -
+
@@ -2062,7 +2062,7 @@ They are **separated by semicolons ";"** This is *matrix URL* notation—something you may not have seen before. -
+
@@ -2090,7 +2090,7 @@ as this one can. The list of heroes is unchanged. No hero row is highlighted. -
+
@@ -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. -
+
@@ -2597,7 +2597,7 @@ Navigation _within_ the feature area remains intact even if you change the paren Here's an example: -
+
@@ -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. -
+
@@ -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_. -
+
@@ -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. -
+
@@ -3030,7 +3030,7 @@ feature module, a dashboard route and two unfinished components to manage crises -
+
@@ -3207,7 +3207,7 @@ Import and add the `LoginRoutingModule` to the `AppModule` imports as well. -
+
@@ -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*. -
+
@@ -3596,7 +3596,7 @@ and fragment to the next route. -
+
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. -
+
@@ -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. -
+
@@ -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`. -
+
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. -
+
diff --git a/aio/content/guide/rx-library.md b/aio/content/guide/rx-library.md index e562d8ed35..0fa67384ce 100644 --- a/aio/content/guide/rx-library.md +++ b/aio/content/guide/rx-library.md @@ -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). -
+
Note that, for Angular apps, we prefer combining operators with pipes, rather than chaining. Chaining is used in many RxJS examples.
@@ -80,7 +80,7 @@ The following converts the previous example to retry the request before catching -
+
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. diff --git a/aio/content/guide/set-document-title.md b/aio/content/guide/set-document-title.md index 3da8382760..c6152acc1d 100644 --- a/aio/content/guide/set-document-title.md +++ b/aio/content/guide/set-document-title.md @@ -22,7 +22,7 @@ The HTML `` 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 diff --git a/aio/content/guide/setup.md b/aio/content/guide/setup.md index bf3100e0b4..d4813d1571 100644 --- a/aio/content/guide/setup.md +++ b/aio/content/guide/setup.md @@ -284,7 +284,7 @@ The following are all in `src/` -<div class="l-sub-section"> +<div class="alert is-helpful"> diff --git a/aio/content/guide/structural-directives.md b/aio/content/guide/structural-directives.md index cc186ac568..87be0a89d4 100644 --- a/aio/content/guide/structural-directives.md +++ b/aio/content/guide/structural-directives.md @@ -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"> diff --git a/aio/content/guide/styleguide.md b/aio/content/guide/styleguide.md index 7abf5b70b4..f99656da6f 100644 --- a/aio/content/guide/styleguide.md +++ b/aio/content/guide/styleguide.md @@ -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. diff --git a/aio/content/guide/template-syntax.md b/aio/content/guide/template-syntax.md index fd0f37d184..32e3122018 100644 --- a/aio/content/guide/template-syntax.md +++ b/aio/content/guide/template-syntax.md @@ -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 diff --git a/aio/content/guide/testing.md b/aio/content/guide/testing.md index 1509483b66..479e421ff6 100644 --- a/aio/content/guide/testing.md +++ b/aio/content/guide/testing.md @@ -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—the component's `click()` method—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 diff --git a/aio/content/guide/typescript-configuration.md b/aio/content/guide/typescript-configuration.md index b7cb188b47..78f1210e23 100644 --- a/aio/content/guide/typescript-configuration.md +++ b/aio/content/guide/typescript-configuration.md @@ -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"> diff --git a/aio/content/guide/universal.md b/aio/content/guide/universal.md index aa1897edc2..5076ee7b74 100644 --- a/aio/content/guide/universal.md +++ b/aio/content/guide/universal.md @@ -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. diff --git a/aio/content/guide/updating.md b/aio/content/guide/updating.md index 244decae62..4c59980dc4 100644 --- a/aio/content/guide/updating.md +++ b/aio/content/guide/updating.md @@ -8,7 +8,7 @@ For information about our versioning policy and practices—including support and deprecation practices, as well as the release schedule—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. diff --git a/aio/content/guide/upgrade.md b/aio/content/guide/upgrade.md index d13603d104..025300cae4 100644 --- a/aio/content/guide/upgrade.md +++ b/aio/content/guide/upgrade.md @@ -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. diff --git a/aio/content/guide/user-input.md b/aio/content/guide/user-input.md index 6f519bcc3c..177ec4c8fc 100644 --- a/aio/content/guide/user-input.md +++ b/aio/content/guide/user-input.md @@ -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"> diff --git a/aio/content/guide/visual-studio-2015.md b/aio/content/guide/visual-studio-2015.md index fdb137f6bf..87ac3ad1ca 100644 --- a/aio/content/guide/visual-studio-2015.md +++ b/aio/content/guide/visual-studio-2015.md @@ -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"> diff --git a/aio/content/marketing/contribute.html b/aio/content/marketing/contribute.html index 76e8ac1620..8cef8c9536 100644 --- a/aio/content/marketing/contribute.html +++ b/aio/content/marketing/contribute.html @@ -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"> - <h3 class="no-anchor">Angular</h3> + <div class="card-section"> + <div> + <h3 class="no-anchor">Angular</h3> - Angular is a next generation mobile and desktop application development platform. + 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"> - <h3 class="no-anchor">Angular Material</h3> + <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> + + <a href="https://github.com/angular/material2/blob/master/CONTRIBUTING.md" class="button button-blue" md-button>Contribute</a> </div> - <div class="l-sub-section"> - <h3 class="no-anchor">AngularFire</h3> + <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> diff --git a/aio/content/tutorial/toh-pt0.md b/aio/content/tutorial/toh-pt0.md index ffee67949c..0079060c60 100644 --- a/aio/content/tutorial/toh-pt0.md +++ b/aio/content/tutorial/toh-pt0.md @@ -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. diff --git a/aio/content/tutorial/toh-pt4.md b/aio/content/tutorial/toh-pt4.md index 0c56a0ba69..f15751d651 100644 --- a/aio/content/tutorial/toh-pt4.md +++ b/aio/content/tutorial/toh-pt4.md @@ -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`. diff --git a/aio/content/tutorial/toh-pt5.md b/aio/content/tutorial/toh-pt5.md index 72a9959033..a1bedcaafe 100644 --- a/aio/content/tutorial/toh-pt5.md +++ b/aio/content/tutorial/toh-pt5.md @@ -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. diff --git a/aio/content/tutorial/toh-pt6.md b/aio/content/tutorial/toh-pt6.md index 91963d11b3..abf12fdfbc 100644 --- a/aio/content/tutorial/toh-pt6.md +++ b/aio/content/tutorial/toh-pt6.md @@ -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. diff --git a/aio/src/styles/2-modules/_alert.scss b/aio/src/styles/2-modules/_alert.scss index cd5b7becca..213e4fc88f 100644 --- a/aio/src/styles/2-modules/_alert.scss +++ b/aio/src/styles/2-modules/_alert.scss @@ -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; } -} \ No newline at end of file +} diff --git a/aio/src/styles/2-modules/_buttons.scss b/aio/src/styles/2-modules/_buttons.scss index 2ebda268bb..deb6086d30 100644 --- a/aio/src/styles/2-modules/_buttons.scss +++ b/aio/src/styles/2-modules/_buttons.scss @@ -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 { @@ -107,4 +115,4 @@ a.filter-button { [mat-button], [mat-raised-button], [mat-button], [mat-raised-button] { text-transform: uppercase; -} \ No newline at end of file +} diff --git a/aio/src/styles/2-modules/_callout.scss b/aio/src/styles/2-modules/_callout.scss index 9de5d2295f..b11f85d702 100644 --- a/aio/src/styles/2-modules/_callout.scss +++ b/aio/src/styles/2-modules/_callout.scss @@ -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; } @@ -44,4 +46,4 @@ background: $blue; } } -} \ No newline at end of file +} diff --git a/aio/src/styles/2-modules/_card.scss b/aio/src/styles/2-modules/_card.scss index e2d12ce0a7..294cd7a01d 100644 --- a/aio/src/styles/2-modules/_card.scss +++ b/aio/src/styles/2-modules/_card.scss @@ -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; + } + +} diff --git a/aio/src/styles/2-modules/_contribute.scss b/aio/src/styles/2-modules/_contribute.scss index 642b9b8586..73cf429502 100644 --- a/aio/src/styles/2-modules/_contribute.scss +++ b/aio/src/styles/2-modules/_contribute.scss @@ -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; diff --git a/aio/src/styles/2-modules/_modules-dir.scss b/aio/src/styles/2-modules/_modules-dir.scss index 1bb94dc4fb..3584f91dc7 100644 --- a/aio/src/styles/2-modules/_modules-dir.scss +++ b/aio/src/styles/2-modules/_modules-dir.scss @@ -24,7 +24,6 @@ @import 'resources'; @import 'scrollbar'; @import 'search-results'; - @import 'subsection'; @import 'toc'; @import 'select-menu'; @import 'deploy-theme'; diff --git a/aio/src/styles/2-modules/_subsection.scss b/aio/src/styles/2-modules/_subsection.scss deleted file mode 100644 index 20dc06cd55..0000000000 --- a/aio/src/styles/2-modules/_subsection.scss +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/aio/src/styles/_print.scss b/aio/src/styles/_print.scss index 6364dcf795..240ac41e50 100644 --- a/aio/src/styles/_print.scss +++ b/aio/src/styles/_print.scss @@ -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; }