Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import { Observable } from 'tns-core-modules/data/observable';
  2. import { isIOS } from "tns-core-modules/platform";
  3. import { Color } from "tns-core-modules/color";
  4. import { request, getFile, getImage, getJSON, getString } from "tns-core-modules/http";
  5.  
  6. export class HomeViewModel extends Observable {
  7.  
  8. items: {
  9. name: string,
  10. desc: string,
  11. price: string,
  12. imageSrc: string,
  13. }[];
  14.  
  15. onItemLoading(args) {
  16. // hack to get around issue with RadListView ios background colors: https://github.com/telerik/nativescript-ui-feedback/issues/196
  17. if (isIOS) {
  18. var newcolor = new Color("#e6e6e6");
  19. args.ios.backgroundView.backgroundColor = newcolor.ios;
  20. }
  21. }
  22.  
  23. constructor() {
  24. super();
  25.  
  26. getJSON("http://localhost:3000/items").then((r: any) => {
  27. this.items = r; // assign it from the response when successful
  28. console.log("blarg!!!")
  29. }, (e) => {
  30. });
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement