{"action":"closed","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/7178","labels_url":"https://api.github.com/repos/angular/angular.js/issues/7178/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/7178/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/7178/events","html_url":"https://github.com/angular/angular.js/issues/7178","id":31902841,"number":7178,"title":"Problem between $compile and template","user":{"login":"yoyeung","id":451538,"avatar_url":"https://avatars.githubusercontent.com/u/451538?v=3","gravatar_id":"","url":"https://api.github.com/users/yoyeung","html_url":"https://github.com/yoyeung","followers_url":"https://api.github.com/users/yoyeung/followers","following_url":"https://api.github.com/users/yoyeung/following{/other_user}","gists_url":"https://api.github.com/users/yoyeung/gists{/gist_id}","starred_url":"https://api.github.com/users/yoyeung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoyeung/subscriptions","organizations_url":"https://api.github.com/users/yoyeung/orgs","repos_url":"https://api.github.com/users/yoyeung/repos","events_url":"https://api.github.com/users/yoyeung/events{/privacy}","received_events_url":"https://api.github.com/users/yoyeung/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/needs%3A+more+info","name":"needs: more info","color":"d7eb9f"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type%3A+bug","name":"type: bug","color":"000000"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/35","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/35/labels","id":526241,"number":35,"title":"Purgatory","description":"This milestone is for issues and PRs that weren't accepted yet and we are waiting for more info from the submitter.\r\n\r\nFor issues this typically means that we weren't able to reproduce the issue or we haven't decided yet if a feature request is a good idea at all.\r\n\r\nFor PRs this means that the PR still needs a lot of work and we might not even be interested in merging it because it looks like a non-core feature. We are still waiting for more discussion within the team or more info from the contributor before making the final decision.","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":86,"closed_issues":246,"state":"open","created_at":"2014-01-04T01:20:50Z","updated_at":"2015-01-14T20:25:12Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2014-04-21T15:46:14Z","updated_at":"2015-01-14T20:25:12Z","closed_at":"2015-01-14T20:25:12Z","body":"I am going to create a directive. When the user click on the element.\r\nIt will render a overlay with list of image. the image array list is a scope variable call \"item\".\r\nWhen i using\r\n\r\n```js \r\n$compile(template)(scope)\r\n```\r\ncannot render any item. I am sure there have item in items.\r\nIf i enable the setting, template: template. It will be fine.\r\n\r\nCan anyone help to explain  why and give me some suggestion.\r\n\r\nThanks\r\n\r\n```js\r\n\r\nangular.module('apple')\r\n\t.directive('showImages', function($compile) {\r\n\t\tvar template = '<div data-ng-repeat=\"item in items\">{{item}}</div><div id=\"detail-overlay\"'+'<div class=\"images\" >{{item.url}}<div>'+\r\n\t\t'<div class=\"info\"> '+\r\n\t\t'<div class=\"corner\">'+\r\n\t\t'<i class=\"type image\"></i><div>'+\r\n\t\t'<div class=\"title\">{{content.title}}</div><div class=\"date\">{{content.date}}</div><div class=\"desc\">{{item.desc}}</div>'\r\n\t\t'</div>'+\r\n\t\t'</div></div>';\r\n\t\tvar _content = $('#content');\r\n\r\n\t    var linker = function(scope, element, attrs) { \r\n\t    \t\r\n\t    \tvar _result = $compile(template)(scope);\r\n\t    \tconsole.log(_result);\r\n\t        element.bind('click',function(){\r\n\t     //    \tscope.rootDirectory = 'images/';\r\n\r\n\t     //    \t//element.html(template);\r\n\t\t     _content.append(_result).show();\r\n\r\n\t\t    //     //$compile(element.contents())(scope);\r\n\t        });\r\n\t    }\r\n\r\n\t    return {\r\n\t        restrict: 'A',\r\n\t        \r\n\t        scope: {\r\n\t            content:'=myContent',\r\n\t            items:'=myItems',\r\n\t        },\r\n\t        link: linker,\r\n\t        //template: template\r\n\t    };\r\n});\r\n```"}}