最佳答案
I have the following directive:
<div teamspeak details="{{data.details}}"></div>
this is the object structure:
data: {
details: {
serverName: { type: 'text', value: 'my server name' },
port: { type: 'number', value: 'my port' },
nickname: { type: 'text' },
password: { type: 'password' },
channel: { type: 'text' },
channelPassword: { type: 'password' },
autoBookmarkAdd: { type: 'checkbox' }
}
}
and I want it to generate a link based on the data inside the data.details
object.
Unfortunately it doesn't work since somehow I cann't access any inner values of the details
object, but if I am passing it a simple data structure like:
<div teamspeak details="{{data.details.serverName.value}}"></div>
I can access it by using {{details}}
.
Here is my Directive Code:
App.directive('teamspeak', function () {
return {
restrict: 'A',
template: "<a href='ts3server://{{details.serverName.value}}:{{details.port.value}}'>Teamspeak Server</a>",
scope: {
details: '@details',
},
link: function (scope, element, attrs) {
}
};
});
Thanks