Famous / famous-angular

Bring structure to your Famo.us apps with the power of AngularJS. Famo.us/Angular integrates seamlessly with existing Angular and Famo.us apps.
https://famo.us/angular
Mozilla Public License 2.0
1.92k stars 275 forks source link

Trying to getAbsolutePosition() from scrollview renderNode #309

Closed koflaherty closed 9 years ago

koflaherty commented 9 years ago

image

I'm trying to get access to a scroll view's getAbsolutePosition() function the same way as in https://github.com/Famous/famous-angular/issues/276. I don't see this function on the prototype chain.

jordanpapaleo commented 9 years ago

Hi @koflaherty

Can you please create a codepen from this template

Thanks,

Jordan

jordanpapaleo commented 9 years ago

Yes, yes that is just an example of working famous-angular. What you will need to do is:

  1. Click the fork button at the top of the screen.
  2. Replace the markup inside the existing fa-app directive with your markup
  3. Replace the JavaScript inside the existing controller with yours.
  4. Click the save button at the top of the screen.
  5. Post the url of that codepen.

This just allow us to better see what you are doing and hopefully help out.

Thanks,

Jordan

koflaherty commented 9 years ago

Found out what was wrong. CodePen Failed to load resource: http://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.js.

Anyways I'm using $famous.find() but the documentation say something about $famousProvider.find(). Do I need to inject $famousProvider to get access to all the famous functionality?

jordanpapaleo commented 9 years ago

Can please you send me the codepen of your code?

Thanks,

Jordan

jordanpapaleo commented 9 years ago

Also can you send me the URL for the place in the reference docs that you are talking about? Thanks - Jordan

koflaherty commented 9 years ago

$famousProvider docs can be found here: https://famo.us/integrations/angular/docs/unstable/api/provider/$famousProvider/index.html.

I'm pretty sure the functionality of $famousProvider was moved to $famous since I can use the $famous.find(id)[0].renderNode. That works. The problem is that some of the functions available on the scroll-view are unavailable, such as getAbsolutePosition(). I am under the impression that if I use $famous.find() I should be able to use all the function available to the scrollview that are listed here: https://famo.us/docs/views/Scrollview

I just checked Codepen and it looks like the angular reference is back up. I'll throw something in there and message back.

koflaherty commented 9 years ago

I switched to Incognito mode in CodePen and then the angualar.js file from google loaded super fast instead of hanging... Interesting. Anyways I threw in a basic example of where I can:

a) get the scrollview render node b) get the position of the scrollview using getPosition() //btw specifying a node doesn't work in this function c) I am trying to us the function getAbsolutePosition(). Doesn't work

http://codepen.io/anon/pen/rajdLa

jordanpapaleo commented 9 years ago

Thanks. Ill take a look.

5inline commented 9 years ago

I just created a simple directive to handle fa-scroll-view events.

Here's a quick gist example: https://gist.github.com/5inline/db366cb5d570ce8e2d86

jordanpapaleo commented 9 years ago

Hi @koflaherty -

image

I saw your screenshot so I know you did not have getAbsolutePosition but I am not sure why bc it is there. I had to update your pen to only console out on a single iteration. Look at this pen and you will see it up the prototype chain. What version of famo.us and famous-angular are you using in your local work? Can you try to use these includes: <script type="text/javascript" src="//code.famo.us/famous/0.3.4/famous-global.js"></script> <script type="text/javascript" src="//code.famo.us/famous-angular/0.6.0/famous-angular.js"></script>

Thanks,

Jordan

koflaherty commented 9 years ago

Thanks Jordan. That did the trick! I'm surprised I was able to replicate the issue in code pen last week but it seems to be working now.

jordanpapaleo commented 9 years ago

Thats great to hear. Thanks for supporting famous-angular.