-
Notifications
You must be signed in to change notification settings - Fork 123
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
what is the angularValueAccessorBindings on the new sencil angular plugin? #6
Comments
Just an update to let any one with the same question to know.
|
what is the source of this? |
@EstevesDiogo mind opening a PR with an update to README with this info? I would appreciate it. |
@yinonov This would be the source (taken from https://www.duetds.com): https://gist.github.com/viljamis/4ef368862b1ac1a914ac77ddf8b0a3aa |
Thanks for opening this issue and adding an example! How would I determine the value of this if I'm not using it with Duet? Do I need to define every custom element I'm making that will trigger events? |
Hello, don't know how to bind stenciljs events |
It seems like some documentation or at least a detailed example is missing for |
Hi, I have a problem related to this: tab-header.tsx import {
Component,
Host,
h,
Element,
Prop,
Event,
EventEmitter,
} from '@stencil/core';
@Component({
tag: 'tab-header',
styleUrl: 'tab-header.css',
shadow: true,
})
export class MyTabHeader {
@Element() el: HTMLElement;
@Prop() label: string = 'Label';
@Prop() ariaLabel?: string;
@Prop() identifier?: string;
@Prop() selected?: boolean;
@Event({ eventName: 'tabclick' }) tabClick: EventEmitter; // <----here
handleClick() {
this.tabClick.emit(); //<----here
}
render() {
return (
<Host role="tab">
<button onClick={() => this.handleClick()}>{this.label}</button>
</Host>
);
}
} tab-panel.tsx import {
Component,
Host,
h,
Element,
Prop,
Event,
EventEmitter,
} from '@stencil/core';
@Component({
tag: 'tab-panel',
styleUrl: 'tab-panel.css',
shadow: true,
})
export class MyTabPanel {
@Element() el: HTMLElement;
@Prop() ariaLabel?: string;
@Prop() identifier?: string;
@Event() clickClose: EventEmitter; //<-----here
emitClose() {
this.clickClose.emit(); //<-----here
}
render() {
return (
<Host>
<div class="container">
<slot>Here goes the content</slot>
<i class="close" tabIndex={0} onClick={() => this.emitClose()}> //<-----here
...
</i>
</div>
</Host>
);
}
} tab-nav.tsx import { Component, Host, h, Element, State, Listen } from '@stencil/core';
import { MyTabHeader } from '../my-tab-header/my-tab-header';
import {MyTabPanel } from '../my-tab-panel/my-tab-panel';
@Component({
tag: 'tab-nav',
styleUrl: 'tab-nav.css',
shadow: true,
})
export class StormMegaNav {
@Element() el: HTMLElement;
@State() navigation: boolean = false;
@State() isVisible: boolean = false;
...
@Listen('tabclick')
clickHandler(ev: CustomEvent<MyTabHeader>) {
this.selectTab(ev.target);
@Listen('clickClose')
closeListener(ev: CustomEvent<MyTabPanel>) {
console.log('>>>>>>clickCloseEvent', ev);
this.closeHandler();
}
... Question yarn run v1.22.4
warning package.json: No license field
$ yarn build.ng
warning package.json: No license field
$ yarn build.es2015 && yarn build.es5
warning package.json: No license field
$ ngc -p tsconfig.json && rollup --config ./scripts/rollup.config.js
src/directives/proxies.ts(298,57): error TS2307: Cannot find module '../my-components/dist/types/components/my-tab-panel/my-tab-panel'.
src/directives/proxies.ts(312,53): error TS2307: Cannot find module '../my-components/dist/types/components/my-tab-header/my-tab-header'.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
AFAIK you shouldn't need to do any value accessor stuff for tabs - it's exclusively for form/input components and integration with angular's reactive forms. |
Thanks :) |
import { Config } from '@stencil/core';
import { angularOutputTarget, ValueAccessorConfig } from '@stencil/angular-output-target';
export const config: Config = { namespace: 'demo', outputTargets: [ angularOutputTarget({ componentCorePackage: 'component-library', directivesProxyFile: '../component-library-angular/src/directives/proxies.ts', valueAccessorConfigs: angularValueAccessorBindings, }), { type: 'dist', }, ], };
The text was updated successfully, but these errors were encountered: