Я использую angularjs с Asp.net MVC, чтобы проверить доступ к записи для папки для пользователей. Если у пользователя есть доступ на запись, я хочу показать div, у которого есть ссылка. У меня есть Div в SampleView.Html, и у меня есть метод, который проверяет доступ пользователя к записи в MVC-контроллере под названием ReportController.cs. Каким будет код для Angular Controller, который я могу использовать для передачи значения от контроллера MVC до Angularjs View?Как передать значение из MVC-контроллера в Angular .html View
SampleView.html:
<div id="DivPackerTemplate" class="cp-btn cp-btn-primary pull-right"><a ng-href="\\Samplefolder" >Edit Template</a></div>
ReportController.cs:
public void AccessPackerPlanTemplate(string folderPath)
{
string path = @"\\sample";
string NtAccountName = @"sampleuser";
DirectoryInfo di = new DirectoryInfo(path);
DirectorySecurity acl = di.GetAccessControl(AccessControlSections.All);
AuthorizationRuleCollection rules = acl.GetAccessRules(true, true, typeof(NTAccount));
//Go through the rules returned from the DirectorySecurity
foreach (AuthorizationRule rule in rules)
{
//If we find one that matches the identity we are looking for
if (rule.IdentityReference.Value.Equals(NtAccountName, StringComparison.CurrentCultureIgnoreCase))
{
//Cast to a FileSystemAccessRule to check for access rights
if ((((FileSystemAccessRule)rule).FileSystemRights & FileSystemRights.WriteData) > 0)
{
//Show the link
{
DivPackerTemplate.Visible = false; \\This is not working is there a alternative for this?
}
}
}
}
Можете ли вы дать мне ссылку на любой образец, который я могу использовать? – Programmermid