Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bidi): make dir and changes readonly #5645

Merged
merged 1 commit into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/cdk/bidi/dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import {
Directive,
HostBinding,
Output,
Input,
EventEmitter
Expand All @@ -23,11 +22,9 @@ import {Direction, Directionality} from './directionality';
*/
@Directive({
selector: '[dir]',
// TODO(hansl): maybe `$implicit` isn't the best option here, but for now that's the best we got.
exportAs: '$implicit',
providers: [
{provide: Directionality, useExisting: Dir}
]
providers: [{provide: Directionality, useExisting: Dir}],
host: {'[dir]': 'dir'},
exportAs: 'dir',
})
export class Dir implements Directionality {
/** Layout direction of the element. */
Expand All @@ -40,7 +37,6 @@ export class Dir implements Directionality {
@Output('dirChange') change = new EventEmitter<void>();

/** @docs-private */
@HostBinding('attr.dir')
@Input('dir')
get dir(): Direction {
return this._dir;
Expand All @@ -56,7 +52,6 @@ export class Dir implements Directionality {

/** Current layout direction of the element. */
get value(): Direction { return this.dir; }
set value(v: Direction) { this.dir = v; }

/** Initialize once default value has been set. */
ngAfterContentInit() {
Expand Down
4 changes: 2 additions & 2 deletions src/cdk/bidi/directionality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const DIR_DOCUMENT = new InjectionToken<Document>('md-dir-doc');
*/
@Injectable()
export class Directionality {
value: Direction = 'ltr';
change = new EventEmitter<void>();
readonly value: Direction = 'ltr';
readonly change = new EventEmitter<void>();

constructor(@Optional() @Inject(DIR_DOCUMENT) _document?: any) {
if (_document) {
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/demo-app/demo-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1>Angular Material Demos</h1>
</div>
</md-toolbar>

<div #root="$implicit" dir="ltr" class="demo-content" [ngSwitch]="changeDetectionStrategy">
<div #root="dir" dir="ltr" class="demo-content" [ngSwitch]="changeDetectionStrategy">
<div *ngSwitchDefault>
<router-outlet></router-outlet>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/tabs/tab-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ describe('MdTabHeader', () => {
beforeEach(() => {
dir = 'rtl';
fixture = TestBed.createComponent(SimpleTabHeaderApp);
fixture.detectChanges();

appComponent = fixture.componentInstance;
appComponent.dir = 'rtl';

fixture.detectChanges();
});

it('should scroll to show the focused tab label', () => {
Expand Down