Skip to content

Commit

Permalink
docs(tree): injectable decorator set on wrong class
Browse files Browse the repository at this point in the history
Fixes the `Injectable` decorator being set on the wrong class in one of the tree examples. This hasn't broken until now because that class isn't using DI anyway.

Fixes #17815.
  • Loading branch information
crisbeto committed Nov 29, 2019
1 parent 9091330 commit e00ec4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class DynamicFlatNode {
* Database for dynamic data. When expanding a node in the tree, the data source will need to fetch
* the descendants data from the database.
*/
@Injectable({providedIn: 'root'})
export class DynamicDatabase {
dataMap = new Map<string, string[]>([
['Fruits', ['Apple', 'Orange', 'Banana']],
Expand Down Expand Up @@ -44,7 +45,6 @@ export class DynamicDatabase {
* The input will be a json object string, and the output is a list of `FileNode` with nested
* structure.
*/
@Injectable()
export class DynamicDataSource implements DataSource<DynamicFlatNode> {

dataChange = new BehaviorSubject<DynamicFlatNode[]>([]);
Expand Down Expand Up @@ -118,8 +118,7 @@ export class DynamicDataSource implements DataSource<DynamicFlatNode> {
@Component({
selector: 'tree-dynamic-example',
templateUrl: 'tree-dynamic-example.html',
styleUrls: ['tree-dynamic-example.css'],
providers: [DynamicDatabase]
styleUrls: ['tree-dynamic-example.css']
})
export class TreeDynamicExample {
constructor(database: DynamicDatabase) {
Expand Down
2 changes: 1 addition & 1 deletion src/dev-app/tree/dynamic-tree-demo/dynamic-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class DynamicFlatNode {
* Database for dynamic data. When expanding a node in the tree, the data
* source will need to fetch the descendants data from the database.
*/
@Injectable({providedIn: 'root'})
export class DynamicDatabase {
dataMap = new Map([
['Fruits', ['Apple', 'Orange', 'Banana']],
Expand Down Expand Up @@ -53,7 +54,6 @@ export class DynamicDatabase {
* object represents a plant or a group of plants. The input will be a JSON object string, and
* the output is a list of `FileNode`-s with a nested structure.
*/
@Injectable()
export class DynamicDataSource implements DataSource<DynamicFlatNode> {

dataChange: BehaviorSubject<DynamicFlatNode[]> = new BehaviorSubject<DynamicFlatNode[]>([]);
Expand Down
3 changes: 1 addition & 2 deletions src/dev-app/tree/dynamic-tree-demo/dynamic-tree-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {DynamicDataSource, DynamicFlatNode, DynamicDatabase} from './dynamic-dat
@Component({
selector: 'dynamic-tree-demo',
templateUrl: 'dynamic-tree-demo.html',
styleUrls: ['dynamic-tree-demo.css'],
providers: [DynamicDatabase]
styleUrls: ['dynamic-tree-demo.css']
})
export class DynamicTreeDemo {

Expand Down

0 comments on commit e00ec4d

Please sign in to comment.