Compile html inside your components using template litterals.
npm install angularjs-html-provider$scope and the $html provider in a component.
$http with $scope as it's only argument will return a tag function.
js
var html = $html($scope)
function view () {
return html
}
`
Example
#### my-button.component.js
`js
MyButtonCtrl.$inject = ['$element']
module.exports = {
controller: MyButtonCtrl,
bindings: {
view: '<'
}
}
function MyButtonCtrl ($element) {
this.$postLink = function () {
var world = 'world'
var el = this.view(world)
$element.replaceWith(el)
}
}
`
#### page.template.html
`html
`
#### page.component.js:
`js
Ctrl.$inject = ['$scope', '$html']
module.exports = {
controller: PageCtrl,
templateUrl: '/page.template.html'
}
function PageCtrl ($scope, $html, Button) {
var html = $html($scope)
this.onClick = function (value) {
alert(Hello ${value}.)
}
this.buttonView = function (world) {
return html
}
}
`
Installation
npm install angularjs-html-provider`