Created
July 2, 2022 16:26
-
-
Save HOLLIX/74d7679c18bf495694fb41d7ee0a805e to your computer and use it in GitHub Desktop.
Fetch JSON Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onInit: function () { | |
const sUrl = "https://api.coinbase.com/v2/currencies", | |
oJSONModel = new JSONModel({ | |
list: [], | |
busy: true, | |
busyIndicatorDelay: 0 | |
}); | |
this.setModel(oJSONModel); | |
jQuery.get(sUrl).then(oData => { | |
oJSONModel.setProperty("/list", oData.data); | |
}).fail(() => { | |
oJSONModel.setProperty("/list", []); | |
}).always(() => { | |
oJSONModel.setProperty("/busy", false); | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page busy="{/busy}" busyIndicatorDelay="{/busyIndicatorDelay}"> | |
<List items="{/list}"> | |
<StandardListItem title="{name}"/> | |
</List> | |
</Page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment