I am trying to customize this working http://jsfiddle.net/markcoleman/JNqqU/ ,in current working fiddle directly object is assigned . where i am trying to change it to $scope.obj.items . passing object to directive is not working .

我正在尝试自定义这个工作http://jsfiddle.net/markcoleman/JNqqU/,在当前工作小提琴直接对象被分配。我试图将其更改为$ scope.obj.items。将对象传递给指令不起作用。

do i need to write some $watch fo r the variable ??? i am getting dynamic value that's why i am trying to pass Object value with this .

我需要写一些$ watch变量???我正在获得动态值,这就是为什么我试图用这个传递Object值。

Code ::

代码::

<a href="#" pop-over items="obj.items", title="Mode of transport">
   Show Pop over</a>

javascript Directive part ::

javascript指令部分::

 scope: {
            items: '=',
            title: '@'
        }

Any suggestion ,

任何建议,

I am trying Below Fiddle http://jsfiddle.net/JNqqU/652/

我正在尝试下面的小提琴http://jsfiddle.net/JNqqU/652/

4 个解决方案

#1


2

You can change your controller to this:

您可以将控制器更改为:

bootstrap.controller('maincnt', function ($scope) {
    $scope.obj = { // declare the scope object here with a blank items 
        items: []
    };
    $scope.updateitem = function () {
        alert('scope update called');
        $scope.obj.items = ['car', 'truck', 'plane', 'bike']; // now update here
    }
});

Checkout fiddle.

结账小提琴。

更多相关文章

  1. Angularjs指令ng-hide在单元格模板中不对网格数据的更改进行绑定
  2. 当开始使用数据-*时,无法识别AngularJS指令
  3. $ postLink的角度组件/指令运行得太早
  4. element.replaceWith在自定义指令的链接中仅在第一次调用时工作
  5. Mac下MySQL-python安装及EnvironmentError: mysql_config not fo
  6. Python 2.6.2中的ElementTree处理指令支持?
  7. 通过指令“ps -l”查看进程信息
  8. 常见压缩格式的区别,及 Linux 下的压缩相关指令
  9. Linux学习笔记_1.Linux常见指令

随机推荐

  1. 字符集问题的初步探讨(五)----如何识别导
  2. SQL:ORDER BY`date`和START WHERE`value`
  3. MYSQL数据库的安装
  4. identity_insert和表初始化脚本
  5. sql语句中各子部分的执行顺序
  6. MySQL 中的函数(一:数学函数)
  7. 3、Oracle PL/SQL中Date格式及格式转换
  8. 浅谈mysql的备份
  9. 1.4.6 收集sql语句的执行计划 2
  10. Python MySQLdb连接数据库的应用