I am creating a SPA inside Sharepoint 2013 by uploading javascript and html files to a document library. I am trying to get current user information by accessing context information through sp.js. But I get this error:
_spPageContextInfo is not defined
In my index.aspx file, I include the following js:
<script src="/_layouts/1033/init.js"></script> <script src="/_layouts/MicrosoftAjax.js"></script> <script src="/_layouts/sp.core.js"></script> <script src="/_layouts/sp.runtime.js"></script> <script src="/_layouts/sp.js"></script>
I also included this at the beginning of the index.aspx file:
<%@ Page language="C#" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
In my js file, I have the following code:
$(document).ready(function() {
It should be noted that I use Angular JS to build the application, and I use the Angular UI router library to navigate between pages.
The document library is inside a child object in the side collection.
eg.
intra.xxx.xxx/xxx/index.aspx
Any suggestions?
source share