0

私はnativescriptでフォームを作成していましたが、私のフィールドにはTextInputLayoutのような浮動小数点が欲しかったので、このプラグインが見つかりましたnativescript-textinputlayout techincallyちょっとしていますが、問題は私がusign angle 2私のアプリケーションでは、そのプラグインを角2で使用する方法を見つけることができないようです。浮動ヒントを実装するためにプラグインを使用する以外の他のソリューションも公開していますNativeScript浮動ヒント

+1

必要。私はそのプラグインを使用する正確なスニペットを持っていませんが、角度https://github.com/bradmartin/nativescript-drawingpad/blob/master/README.md#angularのuiプラグインを使用するサンプルがあります。あなたが必要とする 'registerElement()'になります。 –

+1

本当に助けてくれてありがとう! –

+0

@OmarEssamあなたはそれをどのようにスニペットを投稿できますか?私はいくつかの並べ替えエラーが発生しています。ありがとう – Dlucidone

答えて

0

nativescript-textinputlayoutは "バニラ" NativeScriptコンポーネントです。これをAngularで使用するには、element registry APIを使用してAngularテンプレートの有効なタグとして登録する必要があります。

例:

私-component.component.ts

import { registerElement } from "nativescript-angular/element-registry"; 

registerElement("TextInputLayout",() => require("nativescript-textinputlayout").TextInputLayout); 

@Component({ 
    selector: "my-component", 
    moduleId: module.id, 
    templateUrl: "./my-component.component.html" 
}) 
export class MyComponent {} 

私-component.component.htmlプラグインは、あなたがよされ

<StackLayout> 
    <TextInputLayout hint="my hint" hintAnimationEnabled="true"> 
     <TextField text="my content"></TextField> 
    </TextInputLayout> 
</StackLayout>