我有一个rest web服务是由mvc4和angular js设计的。基本上控制器是AngularJs控制器,它能够调用webService(从apiController扩展)。我有两个页面,一个页面是登录页面,控制器是loginController。下一页是客户页面,控制器是customerController。在loginController中,当用户点击登录时,控制器能够读取用户的信息,例如用户的权限。登录后,客户页面会根据用户的权限显示一些内容。但是我不知道如何将权限从loginController传递给customerController。
现在,我的方法是我尝试将用户的权限保存在HttpContext.Current.Session的“权限”中,但似乎angular js无法从HttpContext.Current.Session的“权限”中读取数据。除非angular js能够有一个方法将值从一个控制器传递到另一个控制器。
发布于 2016-04-20 14:44:03
创建工厂,将权限添加到工厂对象,并注入到customerController中
app.customerController('factory',function(factory)){
}就像这样……
https://stackoverflow.com/questions/36728599
复制相似问题