I've been working on this problem for a couple days. Having gone through
the docs, referenced similar discussions on these boards, and tried many
different approaches, I'm feeling stuck. It feels like there is a solution
that is just a little out of reach. Here's what I have:
<div id="sheet-wrapper" sheetwrapper ng-style="{ width: windowWidth,
height: windowHeight }" ng-controller="MainCtrl" ng-init="init()">
<div id="sheet-block" sheetblock ng-model="sheets">
<div ng-controller="SheetCtrl" ng-repeat="data in bct.sheets"
ng-click="haveFocus($index)" sheet class="sheet-main"></div>
</div>
</div>
bct is a model in SheetCtrl controller that points to a property on the
$bct service. Sheets is an array on the $bct service containing objects
with data to be used by the sheet directive. The data is retrieved
asynchronously. The template URL I want to use with the sheet directive is
part of the data in the ng-repeat. The problem I am having is in accessing
the template property in data at the time the sheet directive is built so
that it can be used as the templateUrl.
The method in the $bct service looks like this:
loadSheet: function(url, data, $index) {
var template = url+'/template';
var bctIndex = this.addSheet({'template':template}, $index);
data = data == 'undefined' ? JSON.stringify(Array()) :
JSON.stringify(data);
$httpConfig = {
method: 'POST',
url: url,
data: data,
headers: {'Content-Type':'application/x-www-form-urlencoded;
charset=UTF-8'},
$bct: this,
$bctIndex: bctIndex
};
$http($httpConfig).success(function(data, status, headers, config) {
config.$bct.updateSheet(data, config.$bctIndex);
}).error(function(data, status, headers, config) {
config.$bct.closeSheet(config.$bctIndex);
});
}
I am very confused as to what my directive should look like. Keeping in
mind that the template coming back also contains angular directives that
need to be linked.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.