| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
######article.md
Set Button tap callback in TypeScript file <snippet id='button-tap-ts'/> Set Button tap callback in JavaScript file <snippet id='button-tap-javascript'/> Set Button in XML <snippet id='button-tap-xml'/>
######text.component.html
<StackLayout sdkExampleTitle sdkToggleNavButton>
<StackLayout class="example-container">
<!-- >> button-tap-xml -->
<Button id="button" text="I am a button" tap="onTap"></Button>
<!-- << button-tap-xml -->
</StackLayout>
</StackLayout>######text.component.js
import { Button, EventData } from "@nativescript/core";
// >> button-tap-javascript
export function onTap(args) {
var myButton = args.object;
console.log(myButton + " was tapped!");
}
// << button-tap-javascript######text.component.ts
import { Button, EventData } from "@nativescript/core";
// >> button-tap-ts
export function onTap(args: EventData) {
let myButton = <Button>args.object;
console.log(myButton + " was tapped!");
}
// << button-tap-ts | Image |
|---|
![]() |
######app/main-view-model.ts
var mainMenuLinks = [
new Link("Button", "/button"),
...
];npm install tns run android
or
npm install tns run ios
npm run build
You can find the build results in the dist directory.
This command pushes to github.com using SSH, so you might need generate a new SSH key and add it to the ssh-agent in case you haven't done so already.
https://github.com/NativeScript/nativescript-sdk-examples-ng/issues
| Back | FazBrowse Home | New Git URL |