Jay Patel
Jay Patel

Reputation: 533

Angular js syntax analyzer

I want to create Syntax analyzer in angular js. I have one textarea. If I write anything like "Select * from Table". then I want to apply some color to keywords like Select in Blue,From in a Red, and Table in another different color. I have keyword's json for this but unable to understand how to do that with angular js. So First Question is, Is it possible? If possible then Is there any directive available for this?

Required a help for above

Upvotes: 1

Views: 281

Answers (1)

gion_13
gion_13

Reputation: 41533

I've been using angular ui-codemirror in the past and it's exactly what you want.
It's a based on the codeMirror synthax highlighter and it's already wrapped in a directive that you could insert as simple as:

<textarea ui-codemirror></textarea>
// or
<div ui-codemirror></div>
// or
<ui-codemirror></ui-codemirror>

Here are some online demos where you can see it in action: http://angular-ui.github.io/ui-codemirror/

Upvotes: 1

Related Questions