geoadmin/mf-geoadmin3 — pull request #140 by loicgasser (2013-07-17 16:07:04+00:00)
Title: WORK IN PROGRESS: search

Hi!

I have a little problem. Could you guys help me out on this one?

In app/src/search/SearchDirective.js:

First what is working:
+ var footer = ['',
+ ''].join([]);
+
+ scope.encodedPermalinkHref =
+ encodeURIComponent(gaPermalink.getHref());
+ scope.encodedDocumentTitle =
+ encodeURIComponent(document.title);
+
+ scope.$on('gaPermalinkChange', function(event) {
+ scope.encodedPermalinkHref =
+ encodeURIComponent(gaPermalink.getHref());
+ });
+
+ var footer_template = angular.element(footer);
+ $compile(footer_template)(scope);

and then:

+ cache: true,
+ footer: footer_template,
+ dataType: config.dataType,

I can create a footer element and compile it and then link it to my scope.
Fine... Not very nice at the moment but it works.

Now, if I try to use the template method of typeahead.

+ template: function(context) {
+ var html = options.setResponseTemplate(context);
+ //var template = angular.element(html);
+ //$compile(template)(scope);
+ //console.log(results_template);
+ //return results_template.html;
+ return html;
+ },

The same method doesn't seem to work. When I try that it seems that my scope is not linked to my element.
(see commented code)

Any idea?