发表于: 2017-06-14 22:14:15
1 890
今天完成的事:1.弄好了wangeditor富文本编辑器,试着加入了地图,结果失败了,还有就是弹出F12,如果点击粗体或者斜体取消的时候,会谈错,弹出的是wangeditor自身程序,怀疑自己是不是控制器出了问题,代码在下面
angular.module('myApp')
.controller('edlit',[function () {
var E = window.wangEditor;
var editor = new E('#editor');
// 或者 var editor = new E( document.getElementById('#editor') )
editor.create()
}])
js引用没问题。
2.用了下自制的Bootstrap+Angularjs自制弹框,不过感觉有点下次,对于自定义指令还不是很熟,有点尬啊,下面的指令弹出也比较一般,但没有优化点的方向。
directive('bsPopup', function ($parse) {
return {
require: 'ngModel',
restrict: 'A',
link: function (scope, elem, attrs, ctrl) {
scope.$watch(function () {
return $parse(ctrl.$modelValue)(scope);
}, function (newValue) {
if (newValue ==0) {
$(elem).modal('hide');
return;
}
if (newValue == 1) {
$(elem).modal('show');
return;
}
});
}
}
});
明天计划完成的事:做翻页插件,顺便弄完接口。
收获:then(fn) 方法中带一个参数,这个参数就是要被执行的函数,并且,这个作为参数的函数本身有一个参数,这个参数就是我们需要的数据,之前对于
.then(function (res) {
$scope.inte =res.data.data.articleList;
})
这样的其实有点纳闷,不过看了下一个简书
http://www.jianshu.com/p/4697357c927f
当初传参的时候其实还是有点纳闷的,莫名不知道怎么实现的。
不过.then说到底是配合异步请求的,完成http请求。
getJson('json1.txt').then(function(){
return getJson('json2.txt');
}).then(function(){
return getJson('json1.txt');
}).then(function(){
return getJson('json2.txt');
}).then(function(d){
console.log('end');
});
});
这样或者
.then(function (res) {
$scope.inte =res.data.data.articleList;
})
这样都木有问题,返回的值都是之前没好好去想的,其实.then就是请求成功就执行函数,以前还以为就差不多就返回和用来console,图样了,照抄菜鸟之类的是不行的。
评论