anglar 跳转子页面
来源:互联网 发布:中国2017网络闭关锁国 编辑:程序博客网 时间:2024/06/09 23:19
// 主页面的js部分的需要加入下面的指令
uzai.directive('script', ($compile) => ({
restrict: 'E',
scope: false,
link(scope, elem, attr) {
if (attr.type === 'text/javascript-lazy' || elem.text().indexOf('childrenFunction.') > -1) {
if (attr.ngSrc) {
let script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', attr.ngSrc);
$doc.body.appendChild(script);
return;
} else {
let code = elem.text();
let f = new Function(code);
f();
}
}
}
}));
let childrenFunction = {
costnotice: function() {
api.endloading();
setTimeout(function() {
//计算子页面高度
individualdetail.jticketshow();
}, 0);
},
window.childrenFunction = window.childrenFunction || childrenFunction;
其他js
append: function(viewName, data, $http, $scope, $compile) {
var angular = window.angular,
createElement = document.createElement('section'),
elementObj,
el,
scriptsData = '<script type="text/javascript">' + 'childrenFunction.' + viewName + '();' + '</script>';
var htmlData;
if (api.isApp()) {
if (typeof(data) == 'string') {
if (devicetype === 'android') {
htmlData = decodeURIComponent(data);
data = {
ErrorCode: 200,
JsonResult: htmlData
};
} else {
data = JSON.parse(data);
}
}
if (data.ErrorCode != 200 || data.JsonResult.trim() == '') {
api.endloading();
if (devicetype === 'android') {
console.log('安卓子页面错误:' + data);
} else {
api.toast(data.ErrorMsg);
}
if (data.JsonResult.trim() == '') {
window.location.hash = '';
return;
}
}
if (devicetype == 'ios') {
elementObj = angular.element(decodeURIComponent(data.JsonResult) + scriptsData);
} else {
var html = decodeURIComponent(data.JsonResult).replace(/´/g, '\'');
html = html.replace(/"/g, '"');
elementObj = angular.element(html + scriptsData);
}
} else {
elementObj = angular.element(data + scriptsData);
}
createElement.id = 'J_router_' + viewName;
createElement.className += 'J-router J-router-' + viewName;
angular.element(document.body).append(createElement);
el = $compile(elementObj)($scope);
angular.element(createElement).append(el);
var routerElements = document.querySelectorAll('.J-router');
if (routerElements.length > 0) {
api.__scrolltop__ = document.body.scrollTop;
[].filter.call(routerElements, function(el) {
el.classList.remove('J-router-show');
});
}
setTimeout(function() {
document.getElementsByClassName('uzai-wrapper')[0].classList.add('hide');
createElement.classList.add('J-router-show');
//angular.element(createElement).addClass('J-router-show').siblings().removeClass('J-router-show');
}, 500);
}
};
<a href="#/页面名称"></a>
阅读全文
0 0
- anglar 跳转子页面
- 子页面跳转
- extjs tabpanel子页面跳转
- 子页面控制父页面跳转
- page页面跳转到子页面和category页面跳转到子页面有区别:
- 页面直接跳转到子页面/二级页面
- Activity跳转到 TabActivity的子页面
- 点击子条目跳转详情页面webview
- 框架中的子页面实现整个页面跳转
- labview从登陆页面跳转到子页面方法一
- extjs的tabpanel子页面跳转到items指定页面
- 在子页面session过期无法跳转到父页面
- 使用iframe框架时,子页面内跳转整个页面
- android从子页面跳转回主页面注意
- iOS 在其他页面跳转到tabBarController的子控制器
- layer页面跳转,获取html子节点元素的值
- showModalDialog 关闭子页面后 父页面跳转 到其它页面
- Crystal Reports 单击子报表不跳转到子报表页面的解决方法
- 布局文件的易混淆点
- java集合基础总结
- JavaScript数据类型的强制转化-数值
- 安卓实现按返回键回到桌面以及再一次按返回键退出应用
- UICollectionView纯代码
- anglar 跳转子页面
- EditText -- password 与 text InputType 转换
- OpenStack Newton版本部署----注意事项
- 合并两个排序的链表
- less学习笔记
- Day2并发
- 单线程和多线程是什么意思 ?
- BZOJ1588 Treap浅谈+裸题
- Visual Studio—— IntelliSense: #error 指令: Please use the /MD switch for _AFXDLL builds