我正在使用AngularJS和Ionic,我正在使用ng-bind-html从其他API中提取数据.我想限制字符数量,但在字符后面还有三个点,以显示用户还有更多要阅读的内容...
到目前为止,我有:
<p ng-bind-html="item.excerpt | limitTo: 100"></p>
Run Code Online (Sandbox Code Playgroud)
但这只会限制角色并将其切断.
我的应用程序正在使用离子和角度js ..我正在尝试为搜索添加一个清晰的按钮,但它不起作用?..我的代码是:
HTML:
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Search" ng-model="search">
</label>
<button class="button ion-android-close input-button button-small"
ng-click="clearSearch()" ng-if="search.length">
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
APP.JS
$scope.clearSearch = function() {
$scope.search = '';
};
Run Code Online (Sandbox Code Playgroud)
也许我需要更多东西,但这不起作用?
有什么帮助谢谢?
我们正在使用离子框架构建一个练习应用程序,它需要按顺序播放多个音频文件,每个音频文件之间有特定的间隔.我们得到了这个工作.现在我们需要将音频文件加入单个文件中.
示例:File_1(长度为4分钟),File_2(长度为3分钟).我们需要一个新的组合单音频文件,长度应为10分钟(File_1 + 3分钟静音+ File_2)
有没有办法在使用angular或cordova的客户端移动应用程序中获得此功能?
情况:
我需要在语言选择中插入标志.我在谷歌和StackOverflow上搜索过但是创建的解决方案对我不起作用.
代码:
在控制器中:
$scope.language_list = [{'name': 'english', 'url': 'https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/gb.png'},{'name': 'italian', 'url': 'https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/it.png'}];
Run Code Online (Sandbox Code Playgroud)
在视图中:
<select ng-model="language_selected">
<option ng-repeat="language in language_list" data-image="{{language.url}}" >{{language.name}}</option>
</select>
Run Code Online (Sandbox Code Playgroud)
例:
http://jsfiddle.net/tcVhN/168/
问题:
如何在角度选择内插入图像?
编辑:
这是解决方案的Plunker,清理了:
我试着这个
.pane {
background: url('../img/fondoapp.png');
background-size: 100% 100% !important;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
}
Run Code Online (Sandbox Code Playgroud)
但是使用.pane或.scrollcontent会在我的其他选项卡中重复显示背景图像,当本机键盘出现时,它会调整图像的大小.
如何loading or please waiting在两条路线之间添加一个.
例如,当我转到类似details.html的页面时,这个pas有http直到页面加载用户看到一个空白页面.
我想要这样的东西:
厂
.factory('DrupalNode', function ($http, $stateParams, REMOTE_URL) {
return {
node: $http.get(REMOTE_URL + 'all/')
//////////////// please wait
}
});
Run Code Online (Sandbox Code Playgroud)
调节器
app.controller('detailController', function($scope, DrupalNode, $state, $window){
DrupalNode.node.success(function(data){
/////////disappear waiting text
$scope.innerData = data;
$scope.whichArticle = $state.params.Nid;
console.log(data);
});
$scope.goBack = function() {
$window.history.back();
};
});
Run Code Online (Sandbox Code Playgroud) 我正在使用离子,我跑ionic build android.出现以下错误.
:CordovaLib:compileDebugJava/Users/jasontanner/Documents/ion/fip/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java:31: error: package org.apache.http.util does not exist
import org.apache.http.util.EncodingUtils;
^
/Users/jasontanner/Documents/ion/fip/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java:430: error: cannot find symbol
byte[] data = base64 ? Base64.decode(dataPartAsString, Base64.DEFAULT) : EncodingUtils.getBytes(dataPartAsString, "UTF-8");
^
symbol: variable EncodingUtils
location: class CordovaResourceApi
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJava'.
> Compilation failed; see the compiler error output for …Run Code Online (Sandbox Code Playgroud) HTML:
<div ng-if="showSubHeader" class="topPull" draggable >
<button class="button-icon" on-swipe-down="changeSlide()"><img src="img/topImg.jpg"></button>
</div>
Run Code Online (Sandbox Code Playgroud)
指示:
.directive('draggable', function () {
return function(scope, element) {
// this gives us the native JS object
var el = element[0];
console.log(el)
el.draggable = true;
el.addEventListener(
'dragstart',
function(e) {
e.originalEvent.dataTransfer.effectAllowed = 'move';
// e.dataTransfer.setData('Text', this.id);
this.classList.add('drag');
return false;
},
false
);
el.addEventListener(
'dragend',
function(e) {
this.classList.remove('drag');
return false;
},
false
);
}
})
Run Code Online (Sandbox Code Playgroud)
错误:
Uncaught TypeError: Cannot read property 'dataTransfer' of undefined(anonymous function) @ controllers.js:12
app.js:19 Uncaught TypeError: Cannot …Run Code Online (Sandbox Code Playgroud) 我在Ionic上关注如何开始推送通知的官方(并且相当棒)的文档.
但是,一旦说明安装了phonegap-plugin-push插件,我收到以下错误:
nikola@Nikolas-Mini ~/Desktop/ionicTesting/ionicPush
> ionic plugin add phonegap-plugin-push
Error: 404 Not Found: phonegap-plugin-push
at RegClient.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:304:14)
at Request._callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:246:65)
at Request.self.callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/request.js:236:22)
at Request.emit (events.js:110:17)
at Request.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/request.js:1142:14)
at Request.emit (events.js:129:20)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/request.js:1096:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
Run Code Online (Sandbox Code Playgroud)
任何人都知道为什么?我试着用cordova代替ionic,但我得到了同样的错误.
我正在使用离子来开发混合应用程序.但最近我发现每当我点击硬件后退按钮时,无论在哪个页面上,应用程序都会退出.我尝试添加以下代码,它确实显示了警告框,但这并不会阻止应用程序退出(不会单击警报框).
$ionicPlatform.onHardwareBackButton(function() {
alert("click on hardware back button");
}
Run Code Online (Sandbox Code Playgroud)
如何阻止应用程序退出硬件后退按钮?
ionic-framework ×10
angularjs ×6
ionic ×4
javascript ×4
cordova ×3
android ×2
css ×1
html5-audio ×1
java ×1
select ×1