小编use*_*788的帖子

如何在Angular js中使用ng-bind-html实现对contenteditable元素的双向绑定?

我刚刚开始讨论Angularjs,并在文档中看到了下面的内容,我如何调整它以使用ng-bind-html作为与ng-model相反的方法.我假设同时使用ng-bind-html和ng-model会发生冲突?

angular.module('customControl', []).
  directive('contenteditable', function() {
    return {
      restrict: 'A', // only activate on element attribute
      require: '?ngModel', // get a hold of NgModelController
      link: function(scope, element, attrs, ngModel) {
        if(!ngModel) return; // do nothing if no ng-model

        // Specify how UI should be updated
        ngModel.$render = function() {
          element.html(ngModel.$viewValue || '');
        };

        // Listen for change events to enable binding
        element.on('blur keyup change', function() {
          scope.$apply(read);
        });
        read(); // initialize

        // Write data to the model
        function read() { …
Run Code Online (Sandbox Code Playgroud)

html javascript binding two-way angularjs

5
推荐指数
1
解决办法
4181
查看次数

错误404:尝试为iOS安装cordova-plugin-zip时的cordova-plugin-file

尝试使用以下方法安装cordoba-plugin-zip时:

cordova plugin add https://github.com/MobileChromeApps/zip.git
Run Code Online (Sandbox Code Playgroud)

记录(https://github.com/MobileChromeApps/cordova-plugin-zip),

我收到以下404错误消息.它尝试引用的cordova-plugin文件是否被移动了?如果是这样,我如何告诉插件在其他地方寻找它?

Installing "cordova-plugin-zip" for ios
Fetching plugin "cordova-plugin-file" via plugin registry
npm http GET http://registry.cordova.io/cordova-plugin-file
npm http 404 http://registry.cordova.io/cordova-plugin-file
Failed to install 'cordova-plugin-zip':Error: 404 Not Found: cordova-plugin-file
Run Code Online (Sandbox Code Playgroud)

registry plugins http-status-code-404 ios cordova

0
推荐指数
1
解决办法
5528
查看次数