Here is something that can catch you off guard when creating a client web part in a SharePoint-hosted app: the default behavior of SharePoint 2013 is to add the X-Frame-Options header with a value of SAMEORIGIN in the HTTP response when it serves up pages from a SharePoint site. The result of this is that a page served up from the app web will not work when you attempt to use it as the page behind a client web part. The way to deal with this problem is to add the following directive to the top of any page in the app web refer...
A gotcha when adding app parts to you app main page.
Share this highlighthttp://www.safaribooksonline.com/a/microsoft-sharepoint-2013/46592/