title: Access contents of external resource in Appery.io
body: <p>I'm new to Appery.io, IONIC and AngularJS but so far it has proven to be a wicked awesome platform for streamlining development.</p>
  
  <p>The problem that I'm having is with integrating external JS resources.</p>
  
  <p><strong>What I'm trying to accomplish - Overview</strong></p>
  
  <p>I'm trying to add <a href="https://developers.braintreepayments.com/start/hello-client/javascript/v2#setup" rel="nofollow">Braintree's drop-in UI</a> payment processing form into one view within my app.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>I keep receiving "Error: Braintree.setup is not a function" error when I run the Braintree.setup() function.</p>
  
  <p><strong>Adding the external library</strong></p>
  
  <p>I include the script by doing the following:</p>
  
  <ol>
  <li>Go to: App Settings > External Resources</li>
  <li>Add script url and save it as an external library</li>
  <li>Set it to enabled so that I can only load it during the payment page view</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/nWIku.png" rel="nofollow"><img src="https://i.stack.imgur.com/nWIku.png" alt="enter image description here"></a></p>
  
  <p><strong>Including the script in the view</strong></p>
  
  <ol>
  <li>Go to "Routing"</li>
  <li>Click "dependencies" for the page I want to load it on</li>
  <li>Select the script > save</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/M5lVS.png" rel="nofollow"><img src="https://i.stack.imgur.com/M5lVS.png" alt="enter image description here"></a></p>
  
  <p><strong>Triggering Braintree.setup()</strong></p>
  
  <ol>
  <li>Pop over to my page > scope</li>
  <li>Add the setup function as listed on the Braintree website. </li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/dTOTP.png" rel="nofollow"><img src="https://i.stack.imgur.com/dTOTP.png" alt="enter image description here"></a></p>
  
  <p><strong>Running the page</strong></p>
  
  <ol>
  <li>Run the page and am provided this error "Error: Braintree.setup is not a function"</li>
  </ol>
  
  <p>NOTE: I am also receiving another error before that but have no idea why. It also appears some demo apps that Appery has provided. Brownie points if you can tell me why.</p>
  
  <p><a href="https://i.stack.imgur.com/D83Mf.png" rel="nofollow"><img src="https://i.stack.imgur.com/D83Mf.png" alt="enter image description here"></a></p>
  
  <p>The script has been loaded as I can see it in Firebug.</p>
  
  <p><a href="https://i.stack.imgur.com/pdTrO.png" rel="nofollow"><img src="https://i.stack.imgur.com/pdTrO.png" alt="enter image description here"></a></p>
  
  <p>NOTE: On the website the code uses braintree.setup() rather than Braintree.setup(). I have switched over to Braintree.setup() because braintree.setup() was giving me an error saying that braintree was not defined. I'm not sure if Braintree is a variable defined in the resources section in which Appery assigns any values from the script to the variable.</p>
  
  <p>Many thanks to anyone who can help!</p>