nstudio / nativescript-checkbox

NativeScript plugin for checkbox UI component
Other
119 stars 56 forks source link

Checkbox not appearing #12

Closed jeffswitzer closed 7 years ago

jeffswitzer commented 7 years ago

I'm having trouble getting a checkbox to show up under an angular2 final nativescript project (android). I did the following:

tns plugin add nativescript-checkbox
tns platform remove android
tns platform add android

I tried adding a sample checkbox like this: app.component.html

<StackLayout xmlns:CheckBox="nativescript-checkbox"> 
    <CheckBox:CheckBox checked="false" text="Test" />
</StackLayout>

app.component.ts

import {Component, OnInit} from '@angular/core';
import app = require('application');
import { CheckBox } from 'nativescript-checkbox';

@Component({
    selector: "main",
    templateUrl: "app.component.html"
})
export class AppComponent implements OnInit {

    constructor() {}

    ngOnInit() {
    }
}

main.ts

import { platformNativeScriptDynamic, NativeScriptModule } from 'nativescript-angular/platform';
import { AppComponent } from './app.component';

@NgModule({
    declarations: [
        AppComponent
    ],
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule
    ]
})
class AppComponentModule {}

platformNativeScriptDynamic().bootstrapModule(AppComponentModule);

I don't see any errors even when I do adb logcat, but I also don't see any checkbox ;) Any ideas? I wasn't sure if I can put xmlns:CheckBox="nativescript-checkbox" in my StackLayout tag... I think the Page tag gets added implicitly somewhere, when I search my project for Page I'm not finding anything and if I wrap my own it's not happy.

bradmartin commented 7 years ago

See this example using the drawing pad plugin here: https://github.com/bradmartin/nativescript-drawingpad#angular it will be similar to render the checkbox.

On Tue, Sep 27, 2016 at 6:40 PM, Jeff Switzer notifications@github.com wrote:

I'm having trouble getting a checkbox to show up under an angular2 final nativescript project (android). I did the following:

tns plugin add nativescript-checkbox tns platform remove android tns platform add android

I tried adding a sample checkbox like this: app.component.html

app.component.ts

import {Component, OnInit} from '@angular/core'; import app = require('application'); import { CheckBox } from 'nativescript-checkbox';

@Component({ selector: "main", templateUrl: "app.component.html" }) export class AppComponent implements OnInit {

constructor() {}

ngOnInit() {
}

}

main.ts

import { platformNativeScriptDynamic, NativeScriptModule } from 'nativescript-angular/platform'; import { AppComponent } from './app.component';

@NgModule({ declarations: [ AppComponent ], bootstrap: [ AppComponent ], imports: [ NativeScriptModule ] }) class AppComponentModule {}

platformNativeScriptDynamic().bootstrapModule(AppComponentModule);

I don't see any errors even when I do adb logcat, but I also don't see any checkbox ;) Any ideas? I wasn't sure if I can put xmlns:CheckBox="nativescript-checkbox" in my StackLayout tag... I think the Page tag gets added implicitly somewhere, when I search my project for Page I'm not finding anything and if I wrap my own it's not happy.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-checkbox/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhBO8ekkRn52OUrTsmUhupi_qiUCIks5qualggaJpZM4KIRXa .

jeffswitzer commented 7 years ago

Brilliant! Thanks bud. You might want to link to that example somewhere - I struggled with it for quite sometime today and you solved it in about 10 seconds :) Great plugin by the way.