0

Context

I'm creating an extractor for some html elements in my application, some elements like <foo key="FOO_KEY">My Value</foo> need to be extracted to be all in a json for i18n purpose.

Because of some specific needs, I can't use angular2 i18n system, so I created my own, using a component, a pipe and a service.

To extract service calls, I can wrap typescript compiler and that's what I've done. Since the last version of my tool (made using angular2 v2.0.0-rc.1) I was perfectly able to get an HTML Ast using those imports:

import {HtmlParser} from "@angular/compiler/src/html_parser";
import {HtmlElementAst, HtmlAttrAst} from "@angular/compiler/src/html_ast";

and parsing the html templates, then getting what I need using the Ast.

Problem

I updated to angular2 v2.0.X and my imports below are not exported anymore. So I'm not able to extract HTML Ast anymore, which is a big issue since it's the only proper way to extract data from html (regex is not an option, see RegEx match open tags except XHTML self-contained tags)

Community
  • 1
  • 1
Supamiu
  • 8,501
  • 7
  • 42
  • 76

1 Answers1

1

In v2.0.0-rc.5 was made breaking changes. Today it looks like:

import { HtmlParser } from "@angular/compiler/src/ml_parser/html_parser";
import { Element, Attribute } from '@angular/compiler/src/ml_parser/ast';
yurzui
  • 205,937
  • 32
  • 433
  • 399
  • I removed the answer check because it's not solving my problem finally :/. since angular2 final is es2015 and my app is a ndoe app, it can't understand es2015, so the importe are not the good ones – Supamiu Oct 14 '16 at 12:22