Skip to content

Commit 147a80f

Browse files
docs(ng1): Reformat ng1 examples markdown
1 parent dbf5dd2 commit 147a80f

File tree

4 files changed

+19
-38
lines changed

4 files changed

+19
-38
lines changed

src/ng1/directives/viewDirective.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ export type UIViewAnimData = {
159159
* controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
160160
* depends on `$resolve` data.
161161
*
162-
* @example
162+
* #### Example:
163163
* ```js
164-
*
165164
* $stateProvider.state('home', {
166165
* template: '<my-component user="$resolve.user"></my-component>',
167166
* resolve: {

src/ng1/interface.ts

+16-32
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import {HookResult} from "ui-router-core";
88
* The StateDeclaration object is used to define a state or nested state.
99
* It should be registered with the [[StateRegistry]].
1010
*
11-
* @example
11+
* #### Example:
1212
* ```js
13-
*
1413
* // StateDeclaration object
1514
* var foldersState = {
1615
* name: 'folders',
@@ -88,9 +87,8 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
8887
*
8988
* Targets three named ui-views in the parent state's template
9089
*
91-
* @example
90+
* #### Example:
9291
* ```js
93-
*
9492
* views: {
9593
* header: {
9694
* controller: "headerCtrl",
@@ -104,9 +102,8 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
104102
* }
105103
* ```
106104
*
107-
* @example
105+
* #### Example:
108106
* ```js
109-
*
110107
* // Targets named ui-view="header" in the template of the ancestor state 'top'
111108
* // and the named `ui-view="body" from the parent state's template.
112109
* views: {
@@ -130,9 +127,8 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
130127
*
131128
* Addresses without an `@` are anchored to the parent state.
132129
*
133-
* @example
130+
* #### Example:
134131
* ```js
135-
*
136132
* // target the `<div ui-view='foo'></div>` created in the parent state's view
137133
* views: { foo: {...} }
138134
* ```
@@ -155,9 +151,8 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
155151
* You can address a `ui-view` absolutely, using dotted notation, by prefixing the address with a `!`. Dotted
156152
* addresses map to the hierarchy of `ui-view`s active in the DOM:
157153
*
158-
* @example
154+
* #### Example:
159155
* ```js
160-
*
161156
* // absolutely target the `<div ui-view='nested'></div>`... which was created
162157
* // in the unnamed/$default root `<ui-view></ui-view>`
163158
* views: { '!$default.nested': {...} }
@@ -168,18 +163,16 @@ export interface Ng1StateDeclaration extends StateDeclaration, Ng1ViewDeclaratio
168163
* Absolute addressing is actually relative addressing, only anchored to the unnamed root state. You can also use
169164
* relative addressing anchored to any state, in order to target a target deeply nested `ui-views`:
170165
*
171-
* @example
166+
* #### Example:
172167
* ```js
173168
*
174-
*
175169
* // target the `<div ui-view='bar'></div>`... which was created inside the
176170
* // `<div ui-view='bar'></div>`... which was created inside the parent state's template.
177171
* views: { 'foo.bar': {...} }
178172
* ```
179173
*
180-
* @example
174+
* #### Example:
181175
* ```js
182-
*
183176
* // target the `<div ui-view='bar'></div>`... which was created in
184177
* // `<div ui-view='foo'></div>`... which was created in a template crom the state `baz.qux`
185178
* views: { 'foo.bar@baz.qux': {...} }
@@ -230,9 +223,8 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
230223
*
231224
* Note: Mapping from resolve names to component inputs may be specified using [[bindings]].
232225
*
233-
* @example
226+
* #### Example:
234227
* ```js
235-
*
236228
* .state('profile', {
237229
* // Use the <my-profile></my-profile> component for the Unnamed view
238230
* component: 'MyProfile',
@@ -281,9 +273,8 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
281273
* Any component bindings that are omitted from this map get the default behavior of mapping to a resolve of the
282274
* same name.
283275
*
284-
* @example
276+
* #### Example:
285277
* ```js
286-
*
287278
* $stateProvider.state('foo', {
288279
* resolve: {
289280
* foo: function(FooService) { return FooService.get(); },
@@ -344,9 +335,8 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
344335
* of a registered controller. The provider will invoked during a Transition in which the view's state is
345336
* entered. The provider is called after the resolve data is fetched.
346337
*
347-
* @example
338+
* #### Example:
348339
* ```js
349-
*
350340
* controllerProvider: function(MyResolveData, $transition$) {
351341
* if (MyResolveData.foo) {
352342
* return "FooCtrl"
@@ -386,15 +376,13 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
386376
*
387377
* If `template` is a function, it will be called with the Transition parameters as the first argument.
388378
*
389-
* @example
379+
* #### Example:
390380
* ```js
391-
*
392381
* template: "<h1>inline template definition</h1><div ui-view></div>"
393382
* ```
394383
*
395-
* @example
384+
* #### Example:
396385
* ```js
397-
*
398386
* template: function(params) {
399387
* return "<h1>generated template</h1>";
400388
* }
@@ -412,15 +400,13 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
412400
*
413401
* If `templateUrl` is a function, it will be called with the Transition parameters as the first argument.
414402
*
415-
* @example
403+
* #### Example:
416404
* ```js
417-
*
418405
* templateUrl: "/templates/home.html"
419406
* ```
420407
*
421-
* @example
408+
* #### Example:
422409
* ```js
423-
*
424410
* templateUrl: function(params) {
425411
* return myTemplates[params.pageId];
426412
* }
@@ -436,9 +422,8 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
436422
* Injected function which returns the HTML template.
437423
* The template will be used to render the corresponding [[ui-view]] directive.
438424
*
439-
* @example
425+
* #### Example:
440426
* ```js
441-
*
442427
* templateProvider: function(MyTemplateService, $transition$) {
443428
* return MyTemplateService.getTemplate($transition$.params().pageId);
444429
* }
@@ -516,9 +501,8 @@ export interface Ng1Controller {
516501
* - Anything else: the transition will continue normally (the state and view will be deactivated)
517502
*
518503
*
519-
* @example
504+
* #### Example:
520505
* ```js
521-
*
522506
* app.component('myComponent', {
523507
* template: '<input ng-model="$ctrl.data" type="text">',
524508
* bindings: { 'data': '<' },

src/ng1/legacy/resolveService.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ var $resolve = {
1818
* injects each function, and waits for the resulting promise to resolve.
1919
* When all resulting promises are resolved, returns the results as an object.
2020
*
21-
* @example
21+
* #### Example:
2222
* ```js
23-
*
2423
* let invocables = {
2524
* foo: [ '$http', ($http) =>
2625
* $http.get('/api/foo').then(resp => resp.data) ],

src/ng1/services.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,8 @@ export const getLocals = (ctx: ResolveContext) => {
312312
*
313313
* This object can be injected into other services.
314314
*
315-
* @example
315+
* #### Example:
316316
* ```js
317-
*
318317
* SomeService.$inject = ['$http', '$stateParams'];
319318
* function SomeService($http, $stateParams) {
320319
* return {

0 commit comments

Comments
 (0)