Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Observable } from 'tns-core-modules/data/observable';
- import { isIOS } from "tns-core-modules/platform";
- import { Color } from "tns-core-modules/color";
- import { request, getFile, getImage, getJSON, getString } from "tns-core-modules/http";
- export class HomeViewModel extends Observable {
- items: {
- name: string,
- desc: string,
- price: string,
- imageSrc: string,
- }[];
- onItemLoading(args) {
- // hack to get around issue with RadListView ios background colors: https://github.com/telerik/nativescript-ui-feedback/issues/196
- if (isIOS) {
- var newcolor = new Color("#e6e6e6");
- args.ios.backgroundView.backgroundColor = newcolor.ios;
- }
- }
- constructor() {
- super();
- getJSON("http://localhost:3000/items").then((r: any) => {
- this.items = r; // assign it from the response when successful
- console.log("blarg!!!")
- }, (e) => {
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement