因为没有错误报告,我不知道出了什么问题.
我有一个组件类
import { Component, OnInit, ViewContainerRef } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
testhtml = "<p>Hello world</p>";
constructor(){}
}
}
Run Code Online (Sandbox Code Playgroud)
在我的模板文件中,我做了这样的事情:
<div class="blog-post">[innerHtml]="testhtml"</div>
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.我还需要输入其他东西吗?
我正在使用angular-cli"版本":"1.0.0-beta.26",
警告:您可能不是要在这里插值中使用颜色值白色。它可能最终表示为白色,这可能会产生无效的 CSS。将颜色名称用作字符串或映射键(例如,“白色”)时,请始终引用颜色名称。如果你真的想在这里使用颜色值,使用'"" + $colorName'。
?
93 ? .text-#{$colorName}-#{$shade} {
? ^^^^^^^^^^
?
src\assets\styles\scss\_palette.scss 93:15 @import
stdin 44:9
Run Code Online (Sandbox Code Playgroud)
我按照推荐尝试了这样的事情,
.text-#{'"" + $colorName'}-#{$shade} {
Run Code Online (Sandbox Code Playgroud)
但是仅仅添加引号是行不通的。我正在使用角度 cli。
我不知道为什么下面的代码会抛出 google api 密钥权限被拒绝的错误。我在 firebase 控制台和 google 控制台中都启用了 api 或服务。
export async function createJobDynamicLink(job){
if(job.jobStatus !== 'approved' || (job.dynamicLink).length > 2){
console.log('Dynamic link already exist!');
return false;
}
console.log(dynamic_links);
console.log(dynamic_links_key);
// Firebase web api key logs just fine
const options = {
method: 'POST',
uri: `https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=${dynamic_links_key}`,
body: {
"longDynamicLink": makeDynamicLongLink(job)
},
json: true
};
return await requestpromise(options)
.then(function (parsedBody) {
console.log(parsedBody);
return parsedBody.shortLink;
})
.then((shortLink) => {
//post.shareUrl = shortLink;
console.log('short link: ' + shortLink);
//return event.data.ref.set(post);
return shortLink;
}) …Run Code Online (Sandbox Code Playgroud) 对于某些服务,我有以下订阅功能。
this.sub = this.route.params.subscribe(params => {
this.id = params['id'];
this._someService
.thisById(this.id)
.subscribe(value => {
this.valueObj = value;
});
});
Run Code Online (Sandbox Code Playgroud)
这似乎没问题。除了我需要在 subscribe 函数之外的以下函数中使用this.valueObj。
private _checkOpeningHours(data: any): string {
const curDayName = this._getDayName();
const todaysOpeningData = ***this.valueObj***.openHours[curDayName];
if (!todaysOpeningData) return "ERROR!";
if (!todaysOpeningData.status) return `IT'S ${curDayName.toUpperCase()} - WE ARE CLOSED TODAY!`;
return `IT'S ${curDayName.toUpperCase()}, ${new Date().toLocaleString("en-US", { hour: '2-digit', minute: '2-digit' })} - ${this._isOpen(todaysOpeningData) ? 'WE ARE OPEN' : 'SORRY, WE ARE CLOSED'}!`;
}
private _refresh() {
this.opening = this._checkOpeningHours(***this.valueObj***.openHours[this._getDayName()]); …Run Code Online (Sandbox Code Playgroud) 这是我的聚合物形式和JavaScript.它推得很好.我想要做的是检查它是否成功,我将隐藏表单并显示一些确认文本或将用户重定向到另一个页面..,
那么,我该如何检查firebase推送是否成功?
<form is="iron-form" method="get" action="firebaseURL/events" id="eventsDemo">
<paper-input name="name" label="Name" required auto-validate></paper-input>
<paper-input name="password" label="Password" type="password" required auto-validate></paper-input>
<paper-checkbox name="read" required>You must check this box</paper-checkbox><br>
<paper-button raised onclick="_delayedSubmit(event)" disabled id="eventsDemoSubmit">
<paper-spinner id="spinner" hidden></paper-spinner>Submit</paper-button>
<div class="output"></div>
</form>
<script>
function _delayedSubmit(event) {
event.preventDefault();
spinner.active = true;
spinner.hidden = false;
eventsDemoSubmit.disabled = true;
// Simulate a slow server response.
setTimeout(function() {
//Polymer.dom(event).localTarget.parentElement.submit();
var firebase = new Firebase(eventsDemo.getAttribute('action'));
firebase.push(eventsDemo.serialize());
}, 100);
}
</script>
Run Code Online (Sandbox Code Playgroud) 基本上我的代码设置如下:
function converttxttoArray( filename )
{
var reader = (window.XMLHttpRequest != null )
? new XMLHttpRequest()
: new ActiveXObject("Microsoft.XMLHTTP");
reader.open("GET", filename, false );
reader.send( );
return reader.responseText.split(/(\r\n|\n)/g);
}
var stop_list = converttxttoArray("../data/stops.txt");
var text = "";
var i;
for (i = 0; i < stop_list.length; i++) {
text += stop_list[i] + "<br>";
}
Run Code Online (Sandbox Code Playgroud)
console.log(text)只会给我:
stop_id,stop_code,stop_name,stop_lat,stop_lon,zone_id,stop_url,location_type,parent_station,platform_code,wheelchair_boarding
70011,70011,San Francisco Caltrain,37.77639,-122.394992,1,http://www.caltrain.com/stations/sanfranciscostation.html,0,ctsf,NB,1
70012,70012,San Francisco Caltrain,37.776348,-122.394935,1,http://www.caltrain.com/stations/sanfranciscostation.html,0,ctsf,SB,1
Run Code Online (Sandbox Code Playgroud)
以下是我的stop.txt文件中的内容如下所示:
stop_id,stop_code,stop_name,stop_lat,stop_lon,zone_id,stop_url,location_type,parent_station,platform_code,wheelchair_boarding
70011,70011,San Francisco Caltrain,37.77639,-122.394992,1,http://www.caltrain.com/stations/sanfranciscostation.html,0,ctsf,NB,1
70012,70012,San Francisco Caltrain,37.776348,-122.394935,1,http://www.caltrain.com/stations/sanfranciscostation.html,0,ctsf,SB,1
70021,70021,22nd St Caltrain,37.757599,-122.39188,1,http://www.caltrain.com/stations/22ndstreetstation.html,0,ct22,NB,2
70022,70022,22nd St Caltrain,37.757583,-122.392404,1,http://www.caltrain.com/stations/22ndstreetstation.html,0,ct22,SB,2
70031,70031,Bayshore Caltrain,37.709537,-122.401586,1,http://www.caltrain.com/stations/bayshorestation.html,0,ctba,NB,1
70032,70032,Bayshore Caltrain,37.709544,-122.40198,1,http://www.caltrain.com/stations/bayshorestation.html,0,ctba,SB,1
70041,70041,So. …Run Code Online (Sandbox Code Playgroud) 我搜索过,但仍然无法得到正确的答案.我很高兴你指出了正确的方向.
我有一个包含用户和项目的数据库
pojects:
08177a0acb3f4d96f8cb5fa19002d2ed:
pid: 08177a0acb3f4d96f8cb5fa19002d2ed,
pName: "Prject 1"
uId: "254",
createdAt: 9377476
users:
254:
userName: "Eric"
uId: "254"
avatar: "image.jpg"
Run Code Online (Sandbox Code Playgroud)
现在我想显示我的项目,我在我的服务中检索列表
this.projectList = this.af.database.list('projects', {
query: {
orderByChild: 'createdAt'
}
});
getProjects() {
return this.projectList.map(snapshot => {
return snapshot;
});
Run Code Online (Sandbox Code Playgroud)
我订阅了component.ts
this.projectService.getProjects()
.subscribe(projects => this.projects = projects);
Run Code Online (Sandbox Code Playgroud)
我想要做的是从用户获取userName并使用项目显示它.
如何在项目中使用uId字段将用户列表中的用户信息检索到一个列表中,以便显示ie {{project.userName}} {{project.avatar}}?
我想检查以下对象是否具有该属性forums以及该属性值是否为true.
{forums: true, pages: true, photos: true, videos: true}
Run Code Online (Sandbox Code Playgroud)
我正在使用 TypeScript Angular 5。
我现在这样做并且工作正常。
let item = 'forums';
if ( this.itemsmodel.hasOwnProperty(item) ) {
//Which is true.
if (this.itemsmodel[item]) {
item = item;
} else {
item = 'pages';
}
}
Run Code Online (Sandbox Code Playgroud)
是否有 Angular 方式或 TypeScript 方式?
我想检查是否在if和else语句中选中或取消选中复选框.
<md-checkbox id="mon" (change)="mon($event)" [checked]="true">Checked</md-checkbox>
mon(e){
if(e.target.checked){
console.log("This is checked")
} else {
console.log("unchecked");
}
}
Run Code Online (Sandbox Code Playgroud)
我想我做错了.我不断得到未定义的检查.怎么做到这一点?
我试图在模板视图中显示一些firebase时间戳,不幸的是没有运气角度datePipe.
<p>Seen {{user.updatedAt | date: 'yyyy/MM/dd h:mm:ss a'}}</p>
Run Code Online (Sandbox Code Playgroud)
我确实得到了这个错误:
ERROR Error: InvalidPipeArgument:
'Unable to convert "Timestamp(seconds=1528515928, nanoseconds=105000000)"
into a date' for pipe 'DatePipe
Run Code Online (Sandbox Code Playgroud) 我正在尝试在颤振中进行下拉选择输入!我想从未来的列表引用中获取数据。
我不知道如何去做,因为这给了我错误:
这是代码:
dropdownButtonHideUnderline(FormFieldState<String> state) {
return FutureBuilder(
future: Global.payCountriesRef.getData(),
builder: (BuildContext context, AsyncSnapshot snap) {
if (snap.hasData) {
List<PayCountries> countries = snap.data;
return new DropdownButtonHideUnderline(
child: new DropdownButton<String>(
value: _sendForm.country,
isDense: true,
onChanged: (String newValue) {
setState(() {
_sendForm.country = newValue;
//_updateDropdownValue(newValue, model);
state.didChange(newValue);
});
},
items: List<String>.from(countries)
.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList()
),
);
}
}
);
}
Run Code Online (Sandbox Code Playgroud) 我有一堂课
class Job {
String id;
String jobTitle;
String updatedAt;
String createdAt;
Job(
{this.id,
this.jobTitle,
this.updatedAt,
this.createdAt});
factory Job.fromMap(Map data) {
return Job(
id: data['id'],
jobTitle: data['jobTitle'],
updatedAt: data['updatedAt'],
createdAt: data['createdAt'],
);
}
}
Run Code Online (Sandbox Code Playgroud)
赋值后:
Job _job = new Job();
Run Code Online (Sandbox Code Playgroud)
例如 _job.jobTitle = 'farmer';
在保存到后端之前,我想确保 _job 对象中没有空值。
而不是检查对象类中的每个项目,例如
If(_job.jobTitle != null && _job.updatedAt != null && ....){
}
Run Code Online (Sandbox Code Playgroud)
如果对象类包含任何空值,我如何进行一步检查?就像是
if(_job.contains(null)){
}
Run Code Online (Sandbox Code Playgroud) 几个月来,我尝试更新应用程序。问题是我想使用 SMS 权限。
为此,我必须在 google play 控制台中填写敏感的许可表。
这样做之后,我的应用程序被拒绝了。
快进,我决定让我的应用项目走一条不同的道路。我不再需要短信功能了。
我已经从我的 android 清单中删除了权限,提高了我的应用程序版本。上传了一个新版本,只是因为相同的权限原因而被拒绝。

我认为这很奇怪,因为我不再为我的应用程序寻求权限。
我检查了应用程序内容选项卡,我可以看到我的应用程序仍然有一些权限问题。

不幸的是,出于某种未知的原因,谷歌没有提供任何从播放控制台停用或删除权限的方法。
由于这个原因,我无法更新我的应用程序。我曾尝试与游戏团队取得联系,但由于某种原因他们没有回复我。
angular ×7
firebase ×3
flutter ×2
javascript ×2
typescript ×2
android ×1
angularfire2 ×1
css ×1
dart ×1
gtfs ×1
node.js ×1
polymer-1.0 ×1
sass ×1
text ×1