虽然安装native-script我得到repositories.cfg无法加载错误,请帮我调试一下.如果你能给出从外部下载文件的方法,它会对我有所帮助.我使用的代码是......
@powershell -NoProfile -ExecutionPolicy Bypass -Command"iex((new-object net.webclient).DownloadString(' https://www.nativescript.org/setup/win '))"
在安装过程中它会卡住,说c:\ user\user-name.android\repositories.cfg无法加载文件
android-studio windows-10 nativescript angular2-nativescript
我创建了一个带有角度2的NativeScript应用程序,我有一个对象数组,我期望在应用程序的前端看到.行为是,如果我直接在ngOnInit()内部将对象推入数组,它可以工作,但如果我在ngOnInit()中创建一个承诺它不起作用.这是代码:
export class DashboardComponent {
stories: Story[] = [];
pushArray() {
let story:Story = new Story(1,1,"ASD", "pushed");
this.stories.push(story);
}
ngOnInit() {
this.pushArray(); //this is shown
var promise = new Promise((resolve)=>{
resolve(42);
console.log("promise hit");
});
promise.then(x=> {
this.pushArray(); //this is NOT shown
});
}
}
Run Code Online (Sandbox Code Playgroud)
相对的html是:
<Label *ngFor="let story of stories" [text]='story.message'></Label>
Run Code Online (Sandbox Code Playgroud)
当应用程序启动时,我只看到一次推送,但是我创建了一个触发"console.log(JSON.stringify(this.stories))"的按钮;" 在那一刻,当我点击按钮时,ui似乎检测到更改的数组,并出现另一个推送的对象.
编辑:
我在这个帖子中创建了一个更简单的例子:Angular 2:当我在ngOnInit中更改promise.than中的变量时,视图不会刷新
我们正在为我们的移动应用程序使用带有角度的nativescript.我想使用Google Play预启动报告功能,但我们的应用需要输入密码.Google Play允许指定密码,但您需要一个资源名称,以便测试脚本可以识别密码的放置位置.
如何在视图中或通过后面的代码或通过任何其他方式指定或接收本机文本字段的资源名称?
有问题的观点:
<StackLayout class="form">
<GridLayout columns="*,90" rows="50">
<TextField #inviteTx
col="0"
height="50"
autocorrect="false"
returnKeyType="next"
(returnPress)="enter(inviteTx.text)"
class="input input-border"
secure="false"
keyboardType="url">
</TextField>
<Button col="1" height="50" class="btn btn-primary w-full fa" text="START " (tap)="enter(inviteTx.text)"></Button>
</GridLayout>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
我做了一些研究,发现在原生android中,可以通过添加android:id属性为TextField添加一个id.
<TextView android:id="@+id/nameTextbox"/>
Run Code Online (Sandbox Code Playgroud)
这似乎不适用于nativescript,之后我无法在R.java中找到该资源.
android google-play nativescript angular2-nativescript google-play-console
我是新手NativeScript,我尝试使用NativeScript和运行我的 HelloWord 应用程序Angular。我连接了我的 android 设备,然后我运行命令tns run android它如何我跟随错误。
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Admin\AppData\Local\Temp\runtimeDir11923-7308-1ed73lj.8p03\framework\app\libs\runtime-libs' at Object.fs.rmdirSync (fs.js:846:18)
at rmkidsSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:247:11)
at rmdirSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:237:7)
at fixWinEPERMSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:150:5)
at rimrafSync (C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_modules\rimraf\rimraf.js:216:26)
at C:\Users\Admin\AppData\Roaming\npm\node_modules\nativescript\node_modules\temp\node_moules\rimraf\rimraf.js:245:5
Run Code Online (Sandbox Code Playgroud)
我怎么了?你能帮忙吗?
webpack nativescript angular2-nativescript nativescript-angular
我正在使用来自Telerik的NativeScript,我使用调试名称("notiApp")创建了一个应用程序,但现在我无法在启动器和操作栏中更改应用程序的名称.
我已经尝试配置我AndroidManifest.xml的/app/App_Resources/Android/修改标签的android:label属性<application>.
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<application
android:label="DESIRED NAME">
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
此外,我尝试更改我的项目的根目录名称为新的应用程序所需的名称.
还有什么我可以做的或者我可以提供的任何其他信息?
先谢谢你们!
我想通过Native Script在iOS中使用3D触控支持.目前有一个快速动作插件,但我想听听ForceTouchiOS设备的动作.我想使用本机iOS API执行此操作,但我不知道如何开始.同一作者
还有另一个Cordova插件,其中有一个函数,我们可以听取下面的强制触摸:
ThreeDeeTouch.watchForceTouches(function(result) {
console.log("force touch % " + result.force); // 84
console.log("force touch timestamp " + result.timestamp); // 1449908744.706419
console.log("force touch x coordinate " + result.x); // 213
console.log("force touch y coordinate " + result.y); // 41
});
Run Code Online (Sandbox Code Playgroud)
如何在NativeScript iOS中访问3D Touch API?
在listview项目中,我Visiblity在布局中使用概念来执行可见和折叠.执行时Collapse,listview项目不会完全从布局中删除该视图.
它正在删除名称和ID等项目内容,但在listview中的特定listitem位置放置空白白色视图.
下面我分享了代码以便更好地理解:
StudentData.ts:
export class StudentData {
constructor(public id: number, public name: string, public collapseData: boolean) {}
}
Run Code Online (Sandbox Code Playgroud)
student.page.html:
<ListView id="listId" [items]="allFeedItems" class="list-group" height="300">
<ng-template let-item="item">
<StackLayout [visibility]="item.collapseData ? 'visible' : 'collapse'" >
<StackLayout orientation="horizontal">
<Label class="item-address" text="address"></Label>
</StackLayout>
.....
</StackLayout>
</ng-template>
</ListView>
Run Code Online (Sandbox Code Playgroud)
怎么了:
例如:在模态类中,我在hashmap中保存listitems的开关控制值.当回到我的主页(即)StudentPage时,我需要完全隐藏特定的行项.但它只删除内容名称和ID.它不会删除该特定列表视图项位置的空白视图.
我期待的是:
删除listview中该特定项目位置的空白视图.
我只是想安装NavtiveScript,为此,我按照官方安装指南进行操作
http://docs.nativescript.org/angular/start/quick-setup but I am stuck at "Step 3: Install iOS and Android requirements"
当我在命令提示符中运行以下命令时(具有管理权限)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Run Code Online (Sandbox Code Playgroud)
一切似乎安装没有任何问题.但是当我尝试通过命令验证安装时,"tns doctor"我返回以下警告:
D:\>tns doctor
WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies …Run Code Online (Sandbox Code Playgroud) 我正在使用带有角度2的nativescript。
我想知道如何在Nativescript项目中快速创建ng组件。例如,在Angular 2中创建我们正在使用的组件ng generate component hello。
是否有针对此的nativescript CLI解决方案?
我使用TabView来浏览用nativescript(ProtectedComponent)编写的移动应用程序.
<TabView
#tabView
tabsBackgroundColor="#f57c00" selectedTabTextColor="#B23010"
[(ngModel)]="selectedIndex"
(selectedIndexChanged)="tabViewIndexChange(tabView.selectedIndex)">
<StackLayout *tabItem="{iconSource: 'res://tab-icons/cats'}">
<cats-tab></cats-tab>
</StackLayout>
<StackLayout *tabItem="{iconSource: 'res://tab-icons/dogs'}">
<dogs-tab></dogs-tab>
</StackLayout>
</TabView>
Run Code Online (Sandbox Code Playgroud)
这是与导航相关的组件代码的一部分:
navigateToCatsRoot() {
this.router.navigate([
'/protected',
{ outlets: { catOutlet: ['cats'] } }
]);
}
navigateToDogsRoot() {
this.router.navigate([
'/protected',
{ outlets: { dogOutlet: ['dogs'] } }
]);
}
tabViewIndexChange(index: number) {
switch(index) {
case 0:
this.navigateToCatsRoot();
break;
case 1:
this.navigateToDogsRoot();
break;
}
}
Run Code Online (Sandbox Code Playgroud)
每个选项卡只包含路由器插座配置,例如:
<router-outlet name="catOutlet"></router-outlet>
Run Code Online (Sandbox Code Playgroud)
路由按以下方式设置:
{ path: "", redirectTo: "/login", pathMatch: "full" },
{ path: "login", …Run Code Online (Sandbox Code Playgroud) nativescript ×10
angular ×4
android ×2
es6-promise ×1
google-play ×1
ios ×1
javascript ×1
routing ×1
telerik ×1
typescript ×1
webpack ×1
windows-10 ×1
xml ×1