我在这样的angularjs中使用了ng-bind
<div ng-bind="getVal()"></div>
Run Code Online (Sandbox Code Playgroud)
其中,getVal()
返回一定的价值,它是在控制器中.但是在Angular2中,我getVal()
在组件中有一个函数,我需要从模板中调用它,就像angular1一样.
我试过了
<div [(ngModel)]="getVal()"></div>
Run Code Online (Sandbox Code Playgroud)
但没有运气,任何想法?
<ion-navbar hideBackButton >
<ion-title> </ion-title>
...
...
Run Code Online (Sandbox Code Playgroud)
我希望hideBackButton
有条件地在那里,我不想用*ngIf重复整个ion-navbar元素.是否可以为hideBackButton属性应用*ngIf?
我想让我的网站缩小80%.即将图像,字体,所有内容缩小到其当前大小的80%.有没有办法用jQuery或CSS做到这一点?
我试过body { zoom:80% }
但它只适用于Chrome.
我想在我的angular2 / ionic2项目中找出特定函数的调用者函数。.arguments.callee.caller.toString()不好运
任何的想法?
我需要从文本文件中删除样式标签。
我尝试了以下代码
String text = readFile("E:/textwithstyletags.txt");
retVal = text.replaceAll("<style(.+?)</style>", "");
Run Code Online (Sandbox Code Playgroud)
当文本文件具有没有新行的样式标签时,即可以使用 <style> body{ color:red; } </style>
像这样有新行时不起作用
<style>
body{
color:red;
}
</style>
Run Code Online (Sandbox Code Playgroud) 我正在使用TypeScript进行AngularJS项目。
A person
是Person
该类的对象。我需要将person
对象存储在其中localStorage
并使用其类型检索它。
我有一个组件,我想在单元测试中检查选择器
@Component({
selector: 'my-component',
)}
Run Code Online (Sandbox Code Playgroud)
我想这样测试
describe('My Component', function(){
it('should have a selector', function() {
expect( ___ ).toBe('my-component');
});
)}
Run Code Online (Sandbox Code Playgroud) 是否有一种简单的方法可以通过路由名称获取@RouteConfig中定义的路由组件?我尝试使用下划线代码,它可以工作,但我需要知道最简单的方法.
let annotations = Reflect.getMetadata('annotations', MyApp)[0].configs;
let route = _.findWhere( annotations, {name: 'RouteName' } );
let component = route.component;
Run Code Online (Sandbox Code Playgroud) 我正在使用内容可编辑的div元素作为ionic2 app的输入文件.它适用于浏览器和Android设备,但ios设备.
<div class="textarea" contenteditable="true" data-placeholder="Add emails"></div>
.ie-textarea {
font-size: fonts(ft-med) + .2;
white-space: normal;
word-wrap: break-word;
min-height: 50px;
}
.ie-textarea:empty:before {
content: attr(data-placeholder);
display: block;
color: clr(grey-light);
}
Run Code Online (Sandbox Code Playgroud)