我正在使用MVC 5/WebApi 2和AngularJs.我想在我的视图中显示登录用户名.我知道如何使用剃刀显示该信息,但我如何使用Angular?所以基本上我需要用Angular来做这件事.
<span >Logged In As: @Html.ActionLink(User.Identity.GetUserName(), "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage", @style = "color:white;float:right" })</span>
Run Code Online (Sandbox Code Playgroud)
apiUserController
public class apiUserController : ApiController
{
// GET api/<controller>
public List<ApplicationUser> Get()
{
using (var context = new ApplicationDbContext())
{
List<ApplicationUser> users = new List<ApplicationUser>();
users = context.ApplicationUsers
.ToList();
return users;
}
}
}
Run Code Online (Sandbox Code Playgroud)
更新
public IHttpActionResult Get()
{
using (var context = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext())))
{
var user = context.FindById(User.Identity.GetUserId());
var loggedInUser = user.UserName;
return …Run Code Online (Sandbox Code Playgroud) 我需要创建一个可以按对象属性分组的表。我无法使用 ngTable 来实现此目的,所以我希望有一种方法可以使用过滤器或嵌套 ng-repeats 来完成此操作。
"CompanyId": "40",
"CompanyName": "XEREX",
"CompanyEmployees": {
"_id": "544",
"CompanyEmployeeFirstName": "Taylor",
"CompanyEmployeeLastName": "Bartlett",
"CompanyEmployeeState": "Vermont"
Run Code Online (Sandbox Code Playgroud)
该表需要显示员工姓名列表,并且需要按州对他们进行分组。
我正在尝试复制我的客户想要的桌面应用程序布局.我需要帮助div之间的空间和表的最小高度.我没有自定义引导程序的经验,所以如果我以错误的方式做到这一点,请分享它应该如何完成.我试图设置一个plunker但我不能让它工作? plunker
<body ng-controller="MainCtrl">
<div class="my-container">
<div class="row clearfix">
<div class="col-md-12 column">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<ul class="nav navbar-nav pull-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Master <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li ng-controller="CustomerCtrl"><a ng-click="CustomerModal()">Customer</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav pull-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">New <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li ng-controller="JobCtrl"><a ng-click="clearSelectedJob();NewJobModal()">Job</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="row clearfix">
<div class="col-md-2 column well">
<div class="classWithPad">
<div class="my-container well classWithPad">
<table class="table …Run Code Online (Sandbox Code Playgroud) 我已经尝试了所有示例,但无法弄清楚。我正在使用这个https://github.com/xinthink/react-native-material-kit
如果我使用尺寸作为宽度,则按钮宽度会超出屏幕。如果可能的话,我希望徽标位于最上方,表单和按钮位于最上方。这仅适用于android。
const btnStyle = {
btn: {
flex: 1,
flexDirection: "row"
//resizeMode: 'cover'
}
};
const ColoredRaisedButton = MKButton.coloredButton()
.withStyle(btnStyle.btn)
.build();
<ScrollView style={styles.scrollView}>
<View style={styles.container}>
{/* Here the magic happens*/}
<View style={styles.cardStyle}>
<Image
source={require("./../img/logo_login.jpg")}
style={styles.cardImageStyle}
/>
<View style={styles.cardContentStyle}>
<Form
ref="form"
type={User}
onChange={this.onChange.bind(this)}
value={this.state.value}
options={options}
/>
</View>
<View style={styles.cardActionStyle}>
<ColoredRaisedButton>
<Text pointerEvents="none" style={styles.buttonText}>
BUTTON
</Text>
</ColoredRaisedButton>
</View>
</View>
</View>
</ScrollView>;
const styles = {
cardStyle: {
flex: 1,
backgroundColor: "#ffffff",
borderRadius: 2,
borderColor: "#ffffff",
borderWidth: 1,
shadowColor: "rgba(0,0,0,.12)",
shadowOpacity: …Run Code Online (Sandbox Code Playgroud) 我正在尝试做一个简单的任务,将 http 响应下载到 pdf。我正在生成一个 pdf 文件,但出现“无法打开 PDF”的错误。
这就是我正在做的事情。
let blob = new Blob([response.data], { type: 'application/pdf' })
FileSaver.saveAs(blob, 'foo.pdf')
Run Code Online (Sandbox Code Playgroud) 我正在将数据加载到文本区域中。我需要将每个属性放在一个新行上。我遇到的问题是行之间的间距。这
<label>Customer Name: </label>
<textarea>{{currentItem.CustomerName}}
{{currentItem.CustomerAddress}}</textarea>
Run Code Online (Sandbox Code Playgroud)
返回这个:
公司名称
水晶街495号
我需要它具有正常的行距。
公司名称
495 Crystal Street
我过滤掉了用户在webapi Get call中可以看到的文档.Document对象中的CompanyName必须与分配了CompanyName的用户匹配.因此,如果分配了CompanyName1和CompanyName2的用户只能返回与其匹配的文档.
public List<Document> GetDocuments()
{
var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
var user = manager.FindById(User.Identity.GetUserId());
using (var context = new ApplicationDbContext())
{
return context.Documents
.Where(j => j.CompanyName == user.CompanyName1) || (j => j.CompanyName == user.CompanyName2) || (j => j.CompanyName == user.CompanyName2)
.ToList();
}
}
Run Code Online (Sandbox Code Playgroud)
这显然不起作用,但这是我需要它做的.
错误1运算符'||' 不能应用于'System.Linq.IQueryable'和'lambda expression'类型的操作数
错误2运营商'.' 不能应用于'lambda表达式'类型的操作数
我正在构建细分数据的输入应用程序.每个细分可以有1到n个部分.我的目标是用所需的输入,文本框,无线电,复选框等动态填充ui.我将来自多个源的数据组合成一个数组.由于这是动态的,我已经创建了将模型更改为唯一名称的服务.现在看起来像什么的屏幕截图
我需要帮助的问题是复选框.我无法从HTML访问它们.这是我如何访问嵌套数组的示例.这很好用.
<tbody>
<tr ng-repeat="item in section.sectionBuilderDeveloper">
<td class="bd-td">{{item.type}}</td>
<td>{{item.name}}</td>
<td class="radio-td">
<div class="radio radio-info radio-inline">
<input type="radio" id="{{item.idStatus1}}" value="{{item.value1}}" ng-model="model[item.status]">
<label for="{{item.forStatus1}}"> Y </label>
</div>
<div class="radio radio-inline">
<input type="radio" id="{{item.idStatus2}}" value="{{item.value2}}" ng-model="model[item.status]">
<label for="{{item.forStatus2}}"> N </label>
</div>
</td>
<td class="radio-td">
<div class="radio radio-info radio-inline">
<input type="radio" id="{{item.idPriceList1}}" value="{{item.value1}}" ng-model="model[item.priceList]">
<label for="{{item.forPriceList1}}"> Y </label>
</div>
<div class="radio radio-inline">
<input type="radio" id="{{item.idPriceList2}}" value="{{item.value2}}" ng-model="model[item.priceList]">
<label for="{{item.forPriceList2}}"> N </label>
</div>
</td>
<td class="radio-td">
<div class="radio radio-info radio-inline">
<input type="radio" id="{{item.idInvSheet1}}" value="{{item.value1}}" …Run Code Online (Sandbox Code Playgroud) 我在解析 RGB 颜色时遇到问题。我需要自己的变量中的 int 值。
这是该对象的屏幕截图

我需要结束这个
数据
[0]
R = 整数值
G = 整数值
B = 整数值
名称 = 字符串值
每个对象都有 2 个属性:名称、颜色。颜色值为 RGB 颜色,rgb(67,134,215)
我需要重新创建对象看起来像
名称=值,
R = 67,
G = 134,
乙 = 215
angularjs ×3
c# ×2
css ×2
javascript ×2
android ×1
asp.net-mvc ×1
blob ×1
filesaver.js ×1
flexbox ×1
html ×1
jquery ×1
lambda ×1
linq ×1
lodash ×1
react-native ×1
reactjs ×1