FHIR.oauth2.ready(function(smart) and AngularJS

582 views
Skip to first unread message

Phil Oxenberg

unread,
Jan 30, 2016, 10:41:31 AM1/30/16
to SMART on FHIR
Using the sandbox, my launch.html gets called and in turn FHIR.oauth2.ready(function(smart) is called inside of index.html.  This all works as expected.  What I'd like to do now is replace my simple index.html with one that uses AngularJS.  Do you have or know of any examples?

Thanks,
Phil

Nikolai Schwertner

unread,
Jan 30, 2016, 10:51:19 AM1/30/16
to smart-...@googlegroups.com
Hi Phil,

There are two existing examples of SMART apps that are based on Angular.js and use the SMART JS client:

https://github.com/smart-on-fhir/fhir-starter
https://github.com/smart-on-fhir/fhir-demo-app

These apps use the general version of the client, which does not assume Angular.js. However, recently we added a version of the client to our builds which is designed for Angular.js (see https://github.com/smart-on-fhir/client-js/tree/master/dist). I haven't tested it extensively, so I can't attest first-hand about it's reliability. If you decide to give it a spin, please let us know of your findings.

Best,
Nikolai
--
You received this message because you are subscribed to the Google Groups "SMART on FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smart-on-fhi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nikolai Schwertner

unread,
Jan 30, 2016, 10:59:04 AM1/30/16
to smart-...@googlegroups.com
To clarify, the difference between the three available versions of the SMART JS client:

   * fhir-client-angularjs.js - uses Angular.js for Ajax requests and async call orchestration
   * fhir-client-jquery.js - uses jQuery for AJax and async call orchestration (jQuery not included)
   * fhir-client.js - uses jQuery for AJax and async call orchestration (jQuery included)

Nikolai Schwertner

unread,
Jan 30, 2016, 11:03:49 AM1/30/16
to smart-...@googlegroups.com
One more thing... fhir-client.js also bundles fhir.js (besides jQuery),
while the other versions look for fhir.js in the global scope (i.e. you
need to add it to your project as well)

Nikolai Schwertner

unread,
Feb 2, 2016, 5:11:12 PM2/2/16
to smart-...@googlegroups.com
You can use fhir-client.js, of course, with Angular.js. However, if you'd like to lighten up your code, you can try the fhir-client-angularjs.js version which does not include jQuery and fhir.js.

On 2/2/16 13:23, Phil Oxenberg wrote:
My non angular launch and index html files include fhir-client.js.  In my angular versions I should be accessing fhir-client-angularjs.js instead, is that correct?

On Sun, Jan 31, 2016 at 7:20 AM, Phil Oxenberg <phil.o...@gmail.com> wrote:
Thanks for the info.  I'll keep you posted on my findings.

--
You received this message because you are subscribed to a topic in the Google Groups "SMART on FHIR" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/smart-on-fhir/LfB613I5l8w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to smart-on-fhi...@googlegroups.com.

Nikolai Schwertner

unread,
Feb 2, 2016, 5:13:30 PM2/2/16
to smart-...@googlegroups.com
This does not look good. I will need to try it on my end to find out what's happening.

On 2/2/16 13:48, Phil Oxenberg wrote:
I get a "ReferenceError: angular is not defined fhir-client-angularjs.js:6261:5".  At this line, angular.module('ng-fhir', ['ng']);
This is from my launch page which aside from the change in fhir client js, remains untouched.

TypeError: Adapter.get(...) is undefined fhir-client-angularjs.js:6515:3

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script src="https://rawgithub.com/smart-on-fhir/client-js/master/dist/fhir-client-angularjs.js"></script>
    <script>
        FHIR.oauth2.authorize({
            "client_id": "my_web_app",
            "scope":  "patient/*.read"
        });
    </script>
</head>
Loading...
</html>

Thanks

On Tue, Feb 2, 2016 at 11:23 AM, Phil Oxenberg <phil.o...@gmail.com> wrote:
My non angular launch and index html files include fhir-client.js.  In my angular versions I should be accessing fhir-client-angularjs.js instead, is that correct?
On Sun, Jan 31, 2016 at 7:20 AM, Phil Oxenberg <phil.o...@gmail.com> wrote:
Thanks for the info.  I'll keep you posted on my findings.
On Sat, Jan 30, 2016 at 9:03 AM, Nikolai Schwertner <nikolai.s...@gmail.com> wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "SMART on FHIR" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/smart-on-fhir/LfB613I5l8w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to smart-on-fhi...@googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages