我有一个自定义滚动条。自从我这样做以来,滚动条的箭头不再显示。
.scrollbar::-webkit-scrollbar-thumb {
background-color: ##00a7e0;
}
.scrollbar::-webkit-scrollbar-track {
background-color: #F5F5F5;
}
.scrollbar::-webkit-scrollbar-button {
????;
}
Run Code Online (Sandbox Code Playgroud)
我必须在.scrollbar ::-webkit-scrollbar-button中添加什么才能再次显示我的箭头?
我想遍历对象数组,这在我的json文件中。
杰森
[
{
"name": "Mike",
"colors": [
{"name": "blue"},
{"name": "white"}
]
},
{
"name": "Phoebe",
"colors": [
{"name": "red"},
{"name": "yellow"}
]
}
]
Run Code Online (Sandbox Code Playgroud)
html
<div *ngFor="let person of persons">
<p>{{person.name}}</p> <!-- this works fine-->
<p *ngFor="let color of person.colors"> <!--I want to list the colors of the person here-->
{{color.name}}
</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我无法访问一个人的颜色数组。我该如何实现?
我已经看过这些帖子,但是它们的解决方案无法帮助我:
我在 Angular 4/5 中搜索了几个关于使用来自其他组件的函数/变量的示例。他们帮助我理解了一点,但我仍然无法找到解决问题的方法。
我想从另一个组件调用标准的 JavaScript警报。
我有一个组件,它有一个这样的变量:
中心.ts
export class CenterPage {
public message = new alert("Warning");
Run Code Online (Sandbox Code Playgroud)
中心.html
<products [message]="message"></products>
Run Code Online (Sandbox Code Playgroud)
我正在使用 @Input 来获取products.ts 中的消息
export class ProductsComponent {
@Input() message;
Run Code Online (Sandbox Code Playgroud)
现在我想显示警报,当用户点击product.html 中的按钮时
<button (click)="message"></button>
Run Code Online (Sandbox Code Playgroud)
这似乎是错误的,我认为这不是我在用户单击按钮时尝试显示警报的正确方式。
我怎样才能正确地做到这一点?
编辑
这只是一个例子。最后,我将不得不在多个组件中调用相同的警报。所以我尝试只使用一个可以从所有组件调用的函数,这样我就不会有多余的代码。
我有一些单选按钮,我想通过onChange获取它们的值。
<input type="radio" name="rating" value="1" onchange="getRating(???)> 1
<input type="radio" name="rating" value="2" onchange="getRating(???)> 2
<input type="radio" name="rating" value="3" onchange="getRating(???)> 3
Run Code Online (Sandbox Code Playgroud)
我的功能:
function getRating(ratingValue) {
$.ajax({
url: '/Rating/Create',
type: "POST",
data: {rating: ratingValue.value },
success: function (data) {
//Successmessage
console.log(ratingValue);
},
error: function (xhr) {
//Errormessage
}
Run Code Online (Sandbox Code Playgroud)
如何获取单选按钮的值?
在Angular的网站上,我读到默认编译是JIT:
https://angular.io/guide/aot-compiler
我想当它在官方Angular网站上时,它必须是JIT,但在许多其他页面上,我读到AOT是Angular 5中的默认编译.
这让我有点困惑.在这个问题中,它还说AOT是默认值:AOT编译是否为angular@4.0.0的默认值?
现在怎么样?
angular ×3
html ×2
alert ×1
angular-aot ×1
angular-cli ×1
arrays ×1
arrows ×1
click ×1
components ×1
css ×1
javascript ×1
jit ×1
json ×1
ngfor ×1
onchange ×1
radio-button ×1
scrollbar ×1
typescript ×1